From 10ed0608f90ee476a07f25c9672d7650e412fb11 Mon Sep 17 00:00:00 2001 From: liyang <1711467488@qq.com> Date: Tue, 12 Jun 2018 11:04:16 +0800 Subject: [PATCH] no message Former-commit-id: 37bb7bd8096cc3f7e152f0b5c2a364c5e4e6fef9 Former-commit-id: a45f6374b941f4e286249accf326e70dc82755e2 Former-commit-id: 4f50b4e5fbd283f3e112fd0cfdcb29ed876f790b Former-commit-id: 658786ee9b6049a45e6bdaac66afd90f56fd83b8 --- src/main.js | 9 ++++++--- src/pages/demo/plugins/day/index.vue | 13 ++++++++++++- src/plugin/open/index.js | 8 ++++++++ 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 src/plugin/open/index.js diff --git a/src/main.js b/src/main.js index 0135ca41..b712e985 100755 --- a/src/main.js +++ b/src/main.js @@ -33,18 +33,21 @@ import '@/mock/register' // vuex import store from '@/store/index.js' -// 插件 log简化 -import pluginLog from '@/plugin/log' // 插件 导出文件 import pluginImport from '@/plugin/import' // 插件 导出文件 import pluginExport from '@/plugin/export' +// 插件 log简化 +import pluginLog from '@/plugin/log' +// 插件 打开页面 +import pluginOpen from '@/plugin/open' Vue.use(ElementUI) -Vue.use(pluginLog) Vue.use(pluginImport) Vue.use(pluginExport) +Vue.use(pluginLog) +Vue.use(pluginOpen) Vue.config.productionTip = false diff --git a/src/pages/demo/plugins/day/index.vue b/src/pages/demo/plugins/day/index.vue index 72321dd9..2892ff42 100644 --- a/src/pages/demo/plugins/day/index.vue +++ b/src/pages/demo/plugins/day/index.vue @@ -2,7 +2,13 @@ @@ -10,5 +16,10 @@ diff --git a/src/plugin/open/index.js b/src/plugin/open/index.js new file mode 100644 index 00000000..1884ba99 --- /dev/null +++ b/src/plugin/open/index.js @@ -0,0 +1,8 @@ +export default { + install (Vue, options) { + // 打开一个url + Vue.prototype.$open = (url = 'https://github.com/FairyEver') => { + window.open(url) + } + } +}