import Vue from 'vue' Vue.directive('power', { inserted(el, type) { const powerList = [] // JSON.parse(JSON.stringify(utils.getSessionStorage('button'))) const [one, two] = type.value.split(':') if (one && !powerList.includes(one)) { if (two === 'tab') { const idAttr = el.getAttribute('aria-labelledby') setTimeout(() => { document.getElementById(idAttr).style.display = 'none' }, 100) } else { el.remove() // el.style.display = 'none' } } } }) Vue.directive('mobile-dropdown', { inserted(el) { if (window.screen.width < 768) { el.addEventListener('click', function(event) { const list = document.querySelectorAll('.el-select-dropdown') const dom = list[list.length - 1] // console.log(el.offsetLeft, 'offsetLeft') // console.log(event.pageX - event.offsetX +  document.body.scrollLeft, 'total') const total = event.pageX - event.offsetX + document.body.scrollLeft dom.style.left = total + 'px' }) } } })