refactor: 混入全局数据

This commit is contained in:
shiziyuan9527 2022-02-24 18:50:40 +08:00 committed by fit2-zhao
parent 66399935d2
commit b87f44cd68
2 changed files with 17 additions and 0 deletions

View File

@ -29,6 +29,7 @@ import formCreate from "@form-create/element-ui"
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
import 'element-ui/lib/theme-chalk/display.css';
import mixin from '../mixin'
Vue.use(mavonEditor)
Vue.use(vueMinderEditor)
@ -56,6 +57,8 @@ Vue.use(VueFab);
Vue.use(JSONPathPicker);
Vue.use(VueClipboard)
Vue.mixin(mixin)
// v-permission
Vue.directive('permission', permission);

View File

@ -0,0 +1,14 @@
import {PROJECT_ID, TokenKey, WORKSPACE_ID} from "@/common/js/constants";
const mixin = {
data() {
return {
msCurrentProjectId: sessionStorage.getItem(PROJECT_ID),
msCurrentWorkspaceId: sessionStorage.getItem(WORKSPACE_ID),
msCurrentUser: JSON.parse(localStorage.getItem(TokenKey)),
msCurrentUserId: JSON.parse(localStorage.getItem(TokenKey)).id
}
}
}
export default mixin