Commit eb8188f2 by 胡悦

修改样式

1 parent 8039de4d
import store from '@/store/index'
import store from '@/store/index';
export const Common = { export const Common = {
setAuthBtn(resData) { setAuthBtn(resData) {
let data = resData || store.getters.curMenuAuth.data; let data = resData || store.getters.curMenuAuth.data
const authBtnEl = document.getElementsByTagName('button'); const authBtnEl = document.getElementsByTagName('button')
const authStringArr = ['新增', '编辑', '删除', '导出', '导入', '修改']; const authStringArr = ['新增', '编辑', '删除', '导出', '导入', '修改']
if(authBtnEl && authBtnEl.length > 0) { if (authBtnEl && authBtnEl.length > 0) {
if(data && data.length > 0) { if (data && data.length > 0) {
authBtnEl.forEach(elItem => { authBtnEl.forEach(elItem => {
let flag = true; let flag = true
let authFlag = false; let authFlag = false
const elText = elItem.innerText; const elText = elItem.innerText
authStringArr.forEach(authItem => { authStringArr.forEach(authItem => {
if(elText.includes(authItem)){ if (elText.includes(authItem)) {
authFlag = true; authFlag = true
return; return
} }
}) })
if(authFlag) { if (authFlag) {
data.forEach(labelItem => { data.forEach(labelItem => {
if(flag) { if (flag) {
elItem.style.display = 'none'; elItem.style.display = 'none'
if(elText.includes(labelItem.label)) { if (elText.includes(labelItem.label)) {
elItem.style.display = 'block'; elItem.style.display = 'inline-block'
flag = false; flag = false
} }
} }
}) })
} }
}); })
} }
} }
},
getAuthData() {
return store.getters.curMenuAuth.data
} }
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!