¶Ô±ÈÐÂÎļþ |
| | |
| | | import store from '@/store'
|
| | | import router from '@/router';
|
| | |
|
| | | export default {
|
| | | // å·æ°å½åtab页ç¾
|
| | | refreshPage(obj) {
|
| | | const { path, matched } = router.currentRoute;
|
| | | if (obj === undefined) {
|
| | | matched.forEach((m) => {
|
| | | if (m.components && m.components.default && m.components.default.name) {
|
| | | if (!['Layout', 'ParentView'].includes(m.components.default.name)) {
|
| | | obj = { name: m.components.default.name, path: path };
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | | return store.dispatch('tagsView/delCachedView', obj).then(() => {
|
| | | const { path } = obj
|
| | | router.replace({
|
| | | path: '/redirect' + path
|
| | | })
|
| | | })
|
| | | },
|
| | | // å
³éå½åtab页ç¾ï¼æå¼æ°é¡µç¾
|
| | | closeOpenPage(obj) {
|
| | | store.dispatch("tagsView/delView", router.currentRoute);
|
| | | if (obj !== undefined) {
|
| | | return router.push(obj);
|
| | | }
|
| | | },
|
| | | // å
³éæå®tab页ç¾
|
| | | closePage(obj) {
|
| | | if (obj === undefined) {
|
| | | return store.dispatch('tagsView/delView', router.currentRoute).then(({ lastPath }) => {
|
| | | return router.push(lastPath || '/');
|
| | | });
|
| | | }
|
| | | return store.dispatch('tagsView/delView', obj);
|
| | | },
|
| | | // å
³éæætab页ç¾
|
| | | closeAllPage() {
|
| | | return store.dispatch('tagsView/delAllViews');
|
| | | },
|
| | | // å
³é左侧tab页ç¾
|
| | | closeLeftPage(obj) {
|
| | | return store.dispatch('tagsView/delLeftTags', obj || router.currentRoute);
|
| | | },
|
| | | // å
³éå³ä¾§tab页ç¾
|
| | | closeRightPage(obj) {
|
| | | return store.dispatch('tagsView/delRightTags', obj || router.currentRoute);
|
| | | },
|
| | | // å
³éå
¶ä»tab页ç¾
|
| | | closeOtherPage(obj) {
|
| | | return store.dispatch('tagsView/delOthersViews', obj || router.currentRoute);
|
| | | },
|
| | | // æ·»å tab页ç¾
|
| | | openPage(title, url) {
|
| | | var obj = { path: url, meta: { title: title } }
|
| | | store.dispatch('tagsView/addView', obj);
|
| | | return router.push(url);
|
| | | },
|
| | | // ä¿®æ¹tab页ç¾
|
| | | updatePage(obj) {
|
| | | return store.dispatch('tagsView/updateVisitedView', obj);
|
| | | }
|
| | | }
|