import Vue from 'vue'
export default {}
/**
 *   ----  权限指令  ---- v-isShow
 *  判断是否有权限查看相关的模块
 */

const isShow = {
	bind: function(el, binding) {
		if (!Vue.prototype.$_isShow(binding)) {
			setTimeout(() => {
				if (el.parentNode) {
					el.parentNode.removeChild(el)
				}
			})
		}
	},
	update: function(el, binding) {
		if (!Vue.prototype.$_isShow(binding)) {
			setTimeout(() => {
				if (el.parentNode) {
					el.parentNode.removeChild(el)
				}
			})
		}
	}
}

const $_isShow = function(val) {
	const urlId = val
	const selfId = uni.getStorageSync('user_id')
	return urlId == selfId
}
Vue.directive('isShow', isShow)
Vue.prototype.$_isShow = $_isShow

