From a724e29dac299bd70289e6ccbd73eacc057b49c6 Mon Sep 17 00:00:00 2001 From: wx-jincw Date: Mon, 24 Feb 2025 11:14:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=80=9A=E7=94=A8minxin=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=BC=95=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bs-ui/src/main.js | 4 ++++ bs-ui/src/mixins/dict-mixin.js | 40 ---------------------------------- 2 files changed, 4 insertions(+), 40 deletions(-) delete mode 100644 bs-ui/src/mixins/dict-mixin.js diff --git a/bs-ui/src/main.js b/bs-ui/src/main.js index 7c43701..db87cbf 100644 --- a/bs-ui/src/main.js +++ b/bs-ui/src/main.js @@ -19,6 +19,8 @@ import './permission' // permission control import { getDicts } from "@/api/system/dict/data"; import { getConfigKey } from "@/api/system/config"; import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/bs"; +import CommonMixin from "./mixins/common-mixin"; + // 分页组件 import Pagination from "@/components/Pagination"; // 自定义表格工具组件 @@ -58,6 +60,8 @@ Vue.component('FileUpload', FileUpload) Vue.component('ImageUpload', ImageUpload) Vue.component('ImagePreview', ImagePreview) +Vue.mixin(CommonMixin); + Vue.use(directive) Vue.use(plugins) Vue.use(VueMeta) diff --git a/bs-ui/src/mixins/dict-mixin.js b/bs-ui/src/mixins/dict-mixin.js deleted file mode 100644 index b6811f4..0000000 --- a/bs-ui/src/mixins/dict-mixin.js +++ /dev/null @@ -1,40 +0,0 @@ - -const DictMixin = { - dicts: [], - computed: { - dict() { - return this.$store.getters.dict; - } - }, - created() { - if (this.$options.dicts) { - const noDicts = []; - const hasDicts = []; - this.$options.dicts.forEach((type) => { - if (!this.dict[type]) { - noDicts.push(type); - } else { - hasDicts.push(type); - } - }); - - if (hasDicts.length > 0 && this.MXDictFetched) { - this.MXDictFetched(hasDicts); - } - - if (noDicts.length === 0) { - return; - } - this.$store.dispatch('dict/fetchDict', { - types: noDicts, - success: () => { - if (this.MXDictFetched) { - this.MXDictFetched(noDicts); - } - } - }); - } - } -} - -export default DictMixin;