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) + } + } +}