// src/main.js import Vue from "vue"; import Cookies from "js-cookie"; import "babel-polyfill"; import Element from "element-ui"; import "./assets/styles/element-variables.scss"; import "@/assets/styles/index.scss"; import "@/assets/styles/ruoyi.scss"; import App from "./App"; import store from "./store"; import router from "./router"; import directive from "./directive"; import plugins from "./plugins"; import { download } from "@/utils/request"; import Print from "vue-print-nb"; import JsonExcel from "vue-json-excel"; import "./assets/icons"; import "./permission"; import { getDicts } from "@/api/system/dict/data"; import { getConfigKey } from "@/api/system/config"; import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree, } from "@/utils/ruoyi"; import Pagination from "@/components/Pagination"; import Editor from "@/components/Editor"; import FileUpload from "@/components/FileUpload"; import ImageUpload from "@/components/ImageUpload"; import ImagePreview from "@/components/ImagePreview"; import DictTag from "@/components/DictTag"; import VueMeta from "vue-meta"; import DictData from "@/components/DictData"; import * as echarts from "echarts"; import VueBarcode from "vue-barcode"; Vue.component("downloadExcel", JsonExcel); Vue.component("barcode", VueBarcode); Vue.component("DictTag", DictTag); Vue.component("Pagination", Pagination); Vue.component("Editor", Editor); Vue.component("FileUpload", FileUpload); Vue.component("ImageUpload", ImageUpload); Vue.component("ImagePreview", ImagePreview); Vue.prototype.getDicts = getDicts; Vue.prototype.getConfigKey = getConfigKey; Vue.prototype.parseTime = parseTime; Vue.prototype.resetForm = resetForm; Vue.prototype.addDateRange = addDateRange; Vue.prototype.selectDictLabel = selectDictLabel; Vue.prototype.selectDictLabels = selectDictLabels; Vue.prototype.download = download; Vue.prototype.handleTree = handleTree; Vue.prototype.$echarts = echarts; // 保留 $showNotification,支持手动触发通知 Vue.prototype.$showNotification = function (type, title, message, onClick) { console.log('触发通知:', { type, title, message }, new Date().toLocaleString()); Vue.prototype.$notify({ title, message, type, duration: 5000, position: 'top-right', offset: 50, onClick, customClass: 'global-notification', appendTo: document.body }); }; // 监听路由变化 router.afterEach(() => { console.log('路由切换完成,当前路径:', router.currentRoute.path); }); const app = new Vue({ el: "#app", router, store, render: (h) => h(App) }); Vue.use(directive); Vue.use(plugins); Vue.use(VueMeta); Vue.use(Print); Vue.use(Element, { size: Cookies.get("size") || "medium", }); DictData.install(); Vue.config.productionTip = false;