Ver código fonte

修复指令绑定时效问题 修复Image组件未注册问题

pixel 3 anos atrás
pai
commit
d0c576fafa
2 arquivos alterados com 4 adições e 3 exclusões
  1. 1 2
      web/src/directive/auth.js
  2. 3 1
      web/src/main.js

+ 1 - 2
web/src/directive/auth.js

@@ -1,10 +1,10 @@
 // 权限按钮展示指令
 import { store } from '@/store/index'
-const userInfo = store.getters['user/userInfo']
 export const auth = (Vue) => {
     Vue.directive('auth', {
         // 当被绑定的元素插入到 DOM 中时……
         bind: function (el, binding) {
+          const userInfo = store.getters['user/userInfo']
           let type = ""
           switch (Object.prototype.toString.call(binding.value)) {
             case "[object Array]":
@@ -27,7 +27,6 @@ export const auth = (Vue) => {
             return
           }
           const waitUse = binding.value.toString().split(",")
-      
           let flag = waitUse.some(item=>item==userInfo.authorityId)
           if (binding.modifiers.not) {
             flag = !flag

+ 3 - 1
web/src/main.js

@@ -52,7 +52,8 @@ import {
     Steps,
     Upload,
     Progress,
-    MessageBox
+    MessageBox,
+    Image
 } from 'element-ui';
 
 Vue.use(Button);
@@ -103,6 +104,7 @@ Vue.use(Upload);
 Vue.use(Progress);
 Vue.use(Scrollbar);
 Vue.use(Loading.directive);
+Vue.use(Image)
 
 Vue.prototype.$loading = Loading.service;
 Vue.prototype.$message = Message;