You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Project development currently provides three functions:
Create Vue components
Create a Vue page and configure routing
Create Vuex submodule
Create Vue components:
addcpn YourComponentName coderwhy# example coderwhy add NavBar, the default will be stored in src / components foldercoderwhy addcpn YourComponentName -d src / Pages and the / Home# specific file can also specify the destination folder
Create a Vue page and configure routing
addPage YourPageName coderwhy# example coderwhy addpage Home, the default will put src / pages / home / Home.vue, and will create a src / Page / Home / router.jscoderwhy addPage YourPageName -d src / views# You can also specify a folder , But need to integrate routing manually
Why is the router.js file created:
router.jsThe file is one of the routing configurations;
Create the filesrc/router/index.jswill be automatically loaded into the routingroutesconfiguration, do not need to manually configured (if it is to configure their own folder requires manual configuration)
src/router/index.jsThe following operations have been completed in:
// Dynamically load all routing files in pagesconstfiles=require.Context('@/pages',true,/router\.js$/);constroutes=files.Keys().Map(key=>{constpage=require('@/pages'+key.replace('.',''));returnpage.default;})
Create Vuex submodule
addstore YourVuexChildModuleName coderwhy# example coderwhy addstore home, the default will put src / store / modules / home / index.js and types.jscoderwhy addstore YourVuexChildModuleName -d src / vuex / modules# You can also specify a folder
After the creation is completed, no manual configuration is required, and all sub-modules have been dynamically integrated: