From 099d62d259c21005b116618c52de48c4e01ce1cc Mon Sep 17 00:00:00 2001 From: imAei Date: Sun, 24 Jul 2022 23:03:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.js | 9 ++++++--- src/plugin/monitor.js | 18 ++++++++++++++++++ src/views/Test3.vue | 8 ++++++++ 3 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 src/plugin/monitor.js diff --git a/src/main.js b/src/main.js index 4194f2f..40821ef 100644 --- a/src/main.js +++ b/src/main.js @@ -3,18 +3,21 @@ * @Author: Wang Dejiang(aei) * @Date: 2022-07-22 23:32:12 * @LastEditors: Wang Dejiang(aei) - * @LastEditTime: 2022-07-22 23:51:00 + * @LastEditTime: 2022-07-24 22:01:36 */ import Vue from 'vue' import App from './App.vue' import router from './router' import store from './store' import * as echarts from 'echarts' +import {monitor} from './plugin/monitor' Vue.prototype.$echarts = echarts Vue.config.productionTip = false -new Vue({ +Vue.use(monitor) +const vue = new Vue({ router, store, render: (h) => h(App) -}).$mount('#app') +}) +vue.$mount('#app') \ No newline at end of file diff --git a/src/plugin/monitor.js b/src/plugin/monitor.js new file mode 100644 index 0000000..25eded7 --- /dev/null +++ b/src/plugin/monitor.js @@ -0,0 +1,18 @@ +/* + * @Descripttion: + * @Author: Wang Dejiang(aei) + * @Date: 2022-07-24 21:56:32 + * @LastEditors: Wang Dejiang(aei) + * @LastEditTime: 2022-07-24 23:02:42 + */ +export const monitor = { + install(Vue, options) { + console.log(options) + console.log('这个插件使用了') + Vue.prototype.$monitor = (el) => { + console.log('当前组件的el', el) + fetch('http://') + + } + } +} \ No newline at end of file diff --git a/src/views/Test3.vue b/src/views/Test3.vue index a58833a..5695b59 100644 --- a/src/views/Test3.vue +++ b/src/views/Test3.vue @@ -1,3 +1,10 @@ + @@ -12,6 +19,7 @@ export default { name: 'Home', mounted() { + this.$monitor(this.$el) const chartDom = document.getElementById('main') const myChart1 = this.$echarts.init(chartDom, 'westeros') let option1 = { -- Gitee