diff --git a/src/main.js b/src/main.js index 4194f2fc81fda0c07bdcd1617ac8527a75038997..40821ef5f7c87d3c5dfbcd1e0c7faf01b3817dd6 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 0000000000000000000000000000000000000000..25eded7be93d04dba3e95d034c08b16d0c887603 --- /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 a58833a7ac7fc84b6b9f8d1f4a363a0b89a2ce71..5695b59b943b386ecae3b318a9f36d79c34ebb63 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 = {