rennycreatevue
v1.2.4
Published
如何安装?
Downloads
6
Readme
說明文檔
如何安装?
npm install rennycreatevue -g
創建項目
创建项目
renny create your_project_name
項目開發
創建VUE組件:
renny addcpn YourComponentName
renny addcpn YourComponentName -d src/pages/home
創建VUE頁面,配置路由
renny addpage YourPageName
renny addpage YourPageName -d src/views
// 動態加載路由文件
const files = require.context('@/pages', true, /router\.js$/);
const routes = files.keys().map(key => {
const page = require('@/pages' + key.replace('.', ''));
return page.default;
})
創建VUEX子模塊
coderwhy addstore YourVuexChildModuleName
coderwhy addstore YourVuexChildModuleName -d src/vuex/modules
const modules = {}
const files = require.context('./', true, /index\.js$/);
files.keys().filter(key => {
if (key === './index.js') return false;
return true
}).map(key => {
const modulePath = key.replace('./modules/', '');
const moduleName = modulePath.replace('/index.js', '');
const module = require(`${key}`);
modules[`${moduleName}`] = module.default;
})