sf-cls-common
v1.0.2
Published
sf cls system frontend package
Downloads
3
Readme
Common
接入方式
在webpack中配置别名 common;
在根文件中,引入权限控制组件;
// 权限控制插件
import VueAuthControl from 'sf-cls-common/plugins/vue-auth-control';
import ElementUI from 'element-ui';
Vue.use(VueAuthControl);
Vue.use(ElementUI);
- 引入Layout组件;
<template>
<layout>
<router-view slot="content"></router-view>
</layout>
</template>
<script>
import layout from 'sf-cls-common/layout/Layout';
export default {
name: 'Sample',
components: { layout },
};
</script>
- 并在vuex中引入store/layout;
import Vue from 'vue';
import Vuex from 'vuex';
import layout from 'sf-cls-common/layout/store/layout';
import * as actions from './actions';
import * as getters from './getters';
import pageA from './modules/pageA';
Vue.use(Vuex);
const store = new Vuex.Store({
strict: process.env.NODE_ENV !== 'production',
actions,
getters,
modules: {
layout,
pageA,
},
});
export default store;
5、ignore设置 gitignore eslintignore
6、依赖(vue-cli项目生成之外的依赖) vuex less less-loader element-ui
7、eslint airbnb
注意事项
1、开发模式的路由方式当前使用的是通过php传参构建的,如需修改,可至components/NestMenu/index.vue进行修改
handleSelect(index, indexPath) {
let realPath = indexPath.join('/');
// eslint-disable-next-line
for (let i = 0; i < indexPath.length; i++) {
if (this.hashMenu[indexPath[i]] && this.hashMenu[indexPath[i]].hash !== false) {
realPath = realPath.replace(`/${indexPath[i]}`, `#/${indexPath[i]}`);
break;
}
}
if (process.env.NODE_ENV !== 'production') { // 在此处修改开发路由
// realPath = realPath.replace(/#/, '.html#');
realPath = `/index.php?page=${realPath}`;
}
location.href = realPath;
},