0.1.1 • Published 3 years ago
school-student v0.1.1
default
只是一个练习项目,旨在熟悉vue-router 和 vuex 结合的规模化开发
Project setup
npm install
编译和热重新加载用于开发
npm run serve
Compiles and minifies for production
npm run build
Run your tests
npm run test
Lints and fixes files
npm run lint
Customize configuration
路由配置
如果新加入的页面需要在sidebar.vue组件中展示,组件基本配置项如下:
例如,新增加一个页面:student.vue
import Page from 'xxxx/BasePage.vue';
export default {
index:0,//左侧路由排序,可以没有,默认使用BasePage中的index:99;
extends:Page,//必须有这个,否则在菜单就不会自动显示
title:"页面title"----这个是左侧导航名称
name: 'Student',------页面名称
props: {
// msg: String
},
data(){
return{
}
},
created(){
},
......
}
routes.js中的配置如下
children:[
....
{
path: '/student',
name: 'Student',
component:Mymodule['Student'],
},
.....
]
自定义组件
本例的自定义组件放到base文件夹下,组件有一个自定义钩子isComponent,只有 isComponent:true 时才会被正确注册.
例如 self.vue组件
export default{
name: 'Self',
isComponent:true,//必须有这个
props: {
msg: String
},
data() {
return {
}
},
created(){
},
}
0.1.1
3 years ago