smart-switch-ui/src/utils/mixins.js

28 lines
522 B
JavaScript
Raw Normal View History

2024-06-17 11:17:00 +08:00
export const $view = {
props: {
view: {
type: String,
default: null
}
},
computed: {
hasView() {
return (views) => {
if (views == null || views.length === 0) {
return false;
}
let list = views;
if (views instanceof String) {
list = views.split(',');
}
return list != null && list.includes(this.view);
}
},
notHasView() {
return (views) => {
return !this.hasView(views);
}
}
}
}