import { views } from '@/utils/constants' export const $view = { props: { view: { type: String, default: null } }, data() { return { views } }, computed: { hasView() { return (views) => { if (views == null || views.length === 0 || this.view == null) { return false; } let list = views; if (views instanceof String) { list = views.split(','); } if (!(list instanceof Array)) { list = [list] } return list.includes(this.view); } }, notHasView() { return (views) => { return !this.hasView(views); } } } } /** * 显隐列 **/ export const $showColumns = { data() { return { columns: [] } }, computed: { showColumns() { if (this.columns == null) { return []; } return this.columns.filter(item => item.visible); }, isShow() { return (key) => { if (this.columns == null) { return false; } let column = this.columns.find(item => item.key === key); return column != null && column.visible; } } }, } // 充值服务费 export const $serviceType = { computed: { // 服务费单位 serviceUnit() { return (type) => { return type === '2' ? '元' : '%'; } } } } // 提现服务费 export const $withdrawServiceType = { computed: { // 提现服务费单位 withdrawServiceUnit() { return (type) => { return type === '2' ? '元' : '%'; } } } }