Coder Social home page Coder Social logo

bitorjs

bitorjs 可以帮助开发者更好地在 VUE & NODE 项目中快速集成插件式开发等功能

使用方法见文档

安装

npm i -S bitorjs

Bitorjs 做了什么

  • 统一了项目目录划分
  • 统一了配置方式
  • 统一了中间件定义及使用
  • 统一的 service 及 Mock
  • 统一采用 webpack 去中心化 require.context 进行目录监听
  • 统一使用注解进行路由注入
  • 统一使用 webpack 进行代码处理

为什么要选择 Bitorjs

  • 让项目迅速具有插件式插件功能
  • 让你使用注解式路由
  • 可与 node 开发统一开发习惯
  • 增加前端 中间件 功能
  • service 与 mock 切换更方便

以上功能是能想到的, 更多功能及作用等你解锁

vue中使用

创建 项目

使用 vue 官方脚手架 vue-cli

  $ vue init webpack xxx
安装依赖
  $ npm install -S bitorjs
  $ npm install -S vuex vuex-persist
  $ npm install -D babel-plugin-transform-decorators-legacy


  and add the following line to your .babelrc file:
  {
    "plugins": ["transform-decorators-legacy"]
}
修改
  1. 创建文件 config/index.env.js

  2. 修改文件 src/main.js

  3.  // The Vue build version to load with the `import` command
     // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
     import Vue from 'vue'
     import Application from 'bitorjs/vue';
     import App from './App'
    
     Vue.config.productionTip = false
    
     new Application({}, App, "#app").start(app => {
       app.watch(require.context('../config', false, /\.js$/))
       app.watch(require.context('.', true, /^((?!\/view\/).)+\.(vue|js)$/));
     })
          
    
  4. 修改文件 src/router/index.js

  5.  import {
       Get,
       Controller
     } from 'bitorjs'
    
     import HelloWorld from '@/components/HelloWorld'
    
     @Controller('/')
     export default class {
       @Get('/')
       async index(ctx){
         ctx.render(HelloWorld)
       }
     }
    

到此, 改造完毕, 接下来,你就可以 开启 bitorjs 之旅

bitorjs's Projects

cli icon cli

Bitorjs 前端框架 工具包

ui icon ui

Bitorjs 前端框架 UI

watcher icon watcher

Bitorjs 前端框架 webpack 插件

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.