feat: add the api of global closing page: $closePage(closeRoute, nextRoute);🌟

新增:增加全局关闭页面api: $closePage(closeRoute, nextRoute);
This commit is contained in:
iczer
2020-08-06 21:12:51 +08:00
parent 9c10453f97
commit c10ea64ba7
4 changed files with 37 additions and 9 deletions

View File

@@ -1,10 +1,12 @@
import VueI18nPlugin from '@/plugins/i18n-extend'
import AuthorityPlugin from '@/plugins/authority-plugin'
import VueI18nPlugin from './i18n-extend'
import AuthorityPlugin from './authority-plugin'
import TabsPagePlugin from './tabs-page-plugin'
const Plugins = {
install: function (Vue) {
Vue.use(VueI18nPlugin)
Vue.use(AuthorityPlugin)
Vue.use(TabsPagePlugin)
}
}
export default Plugins

View File

@@ -0,0 +1,14 @@
const TabsPagePlugin = {
install(Vue) {
Vue.mixin({
methods: {
$closePage(closeRoute, nextRoute) {
const event = new CustomEvent('page:close', {detail:{closeRoute, nextRoute}})
window.dispatchEvent(event)
}
}
})
}
}
export default TabsPagePlugin