@fmdeui/fmui 1.0.28 → 1.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/component.mjs +3 -1
- package/es/components/fm-layout/index.d.ts +32 -0
- package/es/components/fm-layout/src/component/aside.vue.d.ts +5 -0
- package/es/components/fm-layout/src/component/columnsAside.vue.d.ts +5 -0
- package/es/components/fm-layout/src/component/header.vue.d.ts +16 -0
- package/es/components/fm-layout/src/component/main.vue.d.ts +7 -0
- package/es/components/fm-layout/src/footer/index.vue.d.ts +3 -0
- package/es/components/fm-layout/src/index.vue.d.ts +22 -0
- package/es/components/fm-layout/src/logo/index.vue.d.ts +3 -0
- package/es/components/fm-layout/src/main/classic.vue.d.ts +18 -0
- package/es/components/fm-layout/src/main/columns.vue.d.ts +19 -0
- package/es/components/fm-layout/src/main/defaults.vue.d.ts +48 -0
- package/es/components/fm-layout/src/main/transverse.vue.d.ts +18 -0
- package/es/components/fm-layout/src/navBars/index.vue.d.ts +16 -0
- package/es/components/fm-layout/src/navBars/tagsView/contextmenu.vue.d.ts +28 -0
- package/es/components/fm-layout/src/navBars/tagsView/tagsView.vue.d.ts +45 -0
- package/es/components/fm-layout/src/navBars/topBar/breadcrumb.vue.d.ts +3 -0
- package/es/components/fm-layout/src/navBars/topBar/index.vue.d.ts +16 -0
- package/es/components/fm-layout/src/navBars/topBar/search.vue.d.ts +7 -0
- package/es/components/fm-layout/src/navBars/topBar/upgradeInfo.vue.d.ts +5 -0
- package/es/components/fm-layout/src/navBars/topBar/user.vue.d.ts +75 -0
- package/es/components/fm-layout/src/navBars/topBar/userNews.vue.d.ts +9 -0
- package/es/components/fm-layout/src/navMenu/horizontal.vue.d.ts +42 -0
- package/es/components/fm-layout/src/navMenu/subItem.vue.d.ts +42 -0
- package/es/components/fm-layout/src/navMenu/vertical.vue.d.ts +42 -0
- package/es/components/fm-layout/src/routerView/iframes.vue.d.ts +35 -0
- package/es/components/fm-layout/src/routerView/parent.vue.d.ts +3 -0
- package/es/components/fm-layout/src/type.d.ts +2 -0
- package/es/components/fm-layout/style/css.d.ts +0 -0
- package/es/components/fm-layout/style/index.d.ts +0 -0
- package/es/components/index.d.ts +1 -0
- package/es/packages/components/fm-layout/index.mjs +7 -0
- package/es/packages/components/fm-layout/src/component/aside.vue.mjs +5 -0
- package/es/packages/components/fm-layout/src/component/aside.vue2.mjs +175 -0
- package/es/packages/components/fm-layout/src/component/columnsAside.vue.mjs +5 -0
- package/es/packages/components/fm-layout/src/component/columnsAside.vue2.mjs +273 -0
- package/es/packages/components/fm-layout/src/component/header.vue.mjs +5 -0
- package/es/packages/components/fm-layout/src/component/header.vue2.mjs +50 -0
- package/es/packages/components/fm-layout/src/component/main.vue.mjs +5 -0
- package/es/packages/components/fm-layout/src/component/main.vue2.mjs +81 -0
- package/es/packages/components/fm-layout/src/footer/index.vue.mjs +5 -0
- package/es/packages/components/fm-layout/src/footer/index.vue2.mjs +29 -0
- package/es/packages/components/fm-layout/src/index.vue.mjs +5 -0
- package/es/packages/components/fm-layout/src/index.vue2.mjs +91 -0
- package/es/packages/components/fm-layout/src/logo/index.vue.mjs +5 -0
- package/es/packages/components/fm-layout/src/logo/index.vue2.mjs +57 -0
- package/es/packages/components/fm-layout/src/main/classic.vue.mjs +5 -0
- package/es/packages/components/fm-layout/src/main/classic.vue2.mjs +87 -0
- package/es/packages/components/fm-layout/src/main/columns.vue.mjs +5 -0
- package/es/packages/components/fm-layout/src/main/columns.vue2.mjs +100 -0
- package/es/packages/components/fm-layout/src/main/defaults.vue.mjs +5 -0
- package/es/packages/components/fm-layout/src/main/defaults.vue2.mjs +153 -0
- package/es/packages/components/fm-layout/src/main/transverse.vue.mjs +5 -0
- package/es/packages/components/fm-layout/src/main/transverse.vue2.mjs +70 -0
- package/es/packages/components/fm-layout/src/navBars/index.vue.mjs +5 -0
- package/es/packages/components/fm-layout/src/navBars/index.vue2.mjs +44 -0
- package/es/packages/components/fm-layout/src/navBars/tagsView/contextmenu.vue.mjs +5 -0
- package/es/packages/components/fm-layout/src/navBars/tagsView/contextmenu.vue2.mjs +156 -0
- package/es/packages/components/fm-layout/src/navBars/tagsView/tagsView.vue.mjs +5 -0
- package/es/packages/components/fm-layout/src/navBars/tagsView/tagsView.vue2.mjs +576 -0
- package/es/packages/components/fm-layout/src/navBars/topBar/breadcrumb.vue.mjs +5 -0
- package/es/packages/components/fm-layout/src/navBars/topBar/breadcrumb.vue2.mjs +169 -0
- package/es/packages/components/fm-layout/src/navBars/topBar/index.vue.mjs +5 -0
- package/es/packages/components/fm-layout/src/navBars/topBar/index.vue2.mjs +113 -0
- package/es/packages/components/fm-layout/src/navBars/topBar/search.vue.mjs +5 -0
- package/es/packages/components/fm-layout/src/navBars/topBar/search.vue2.mjs +120 -0
- package/es/packages/components/fm-layout/src/navBars/topBar/upgradeInfo.vue.mjs +5 -0
- package/es/packages/components/fm-layout/src/navBars/topBar/upgradeInfo.vue2.mjs +72 -0
- package/es/packages/components/fm-layout/src/navBars/topBar/user.vue.mjs +5 -0
- package/es/packages/components/fm-layout/src/navBars/topBar/user.vue2.mjs +699 -0
- package/es/packages/components/fm-layout/src/navBars/topBar/userNews.vue.mjs +5 -0
- package/es/packages/components/fm-layout/src/navBars/topBar/userNews.vue2.mjs +255 -0
- package/es/packages/components/fm-layout/src/navMenu/horizontal.vue.mjs +5 -0
- package/es/packages/components/fm-layout/src/navMenu/horizontal.vue2.mjs +182 -0
- package/es/packages/components/fm-layout/src/navMenu/subItem.vue.mjs +5 -0
- package/es/packages/components/fm-layout/src/navMenu/subItem.vue2.mjs +113 -0
- package/es/packages/components/fm-layout/src/navMenu/vertical.vue.mjs +5 -0
- package/es/packages/components/fm-layout/src/navMenu/vertical.vue2.mjs +159 -0
- package/es/packages/components/fm-layout/src/routerView/iframes.vue.mjs +5 -0
- package/es/packages/components/fm-layout/src/routerView/iframes.vue2.mjs +128 -0
- package/es/packages/components/fm-layout/src/routerView/parent.vue.mjs +5 -0
- package/es/packages/components/fm-layout/src/routerView/parent.vue2.mjs +141 -0
- package/es/packages/components/fm-layout/src/type.mjs +1 -0
- package/es/packages/components/index.mjs +1 -0
- package/index.js +4071 -73
- package/index.min.js +5 -5
- package/index.min.mjs +5 -5
- package/index.mjs +4082 -81
- package/lib/{index.css → component.css} +2 -2
- package/lib/component.js +3 -1
- package/lib/components/fm-layout/index.d.ts +32 -0
- package/lib/components/fm-layout/src/component/aside.vue.d.ts +5 -0
- package/lib/components/fm-layout/src/component/columnsAside.vue.d.ts +5 -0
- package/lib/components/fm-layout/src/component/header.vue.d.ts +16 -0
- package/lib/components/fm-layout/src/component/main.vue.d.ts +7 -0
- package/lib/components/fm-layout/src/footer/index.vue.d.ts +3 -0
- package/lib/components/fm-layout/src/index.vue.d.ts +22 -0
- package/lib/components/fm-layout/src/logo/index.vue.d.ts +3 -0
- package/lib/components/fm-layout/src/main/classic.vue.d.ts +18 -0
- package/lib/components/fm-layout/src/main/columns.vue.d.ts +19 -0
- package/lib/components/fm-layout/src/main/defaults.vue.d.ts +48 -0
- package/lib/components/fm-layout/src/main/transverse.vue.d.ts +18 -0
- package/lib/components/fm-layout/src/navBars/index.vue.d.ts +16 -0
- package/lib/components/fm-layout/src/navBars/tagsView/contextmenu.vue.d.ts +28 -0
- package/lib/components/fm-layout/src/navBars/tagsView/tagsView.vue.d.ts +45 -0
- package/lib/components/fm-layout/src/navBars/topBar/breadcrumb.vue.d.ts +3 -0
- package/lib/components/fm-layout/src/navBars/topBar/index.vue.d.ts +16 -0
- package/lib/components/fm-layout/src/navBars/topBar/search.vue.d.ts +7 -0
- package/lib/components/fm-layout/src/navBars/topBar/upgradeInfo.vue.d.ts +5 -0
- package/lib/components/fm-layout/src/navBars/topBar/user.vue.d.ts +75 -0
- package/lib/components/fm-layout/src/navBars/topBar/userNews.vue.d.ts +9 -0
- package/lib/components/fm-layout/src/navMenu/horizontal.vue.d.ts +42 -0
- package/lib/components/fm-layout/src/navMenu/subItem.vue.d.ts +42 -0
- package/lib/components/fm-layout/src/navMenu/vertical.vue.d.ts +42 -0
- package/lib/components/fm-layout/src/routerView/iframes.vue.d.ts +35 -0
- package/lib/components/fm-layout/src/routerView/parent.vue.d.ts +3 -0
- package/lib/components/fm-layout/src/type.d.ts +2 -0
- package/lib/components/fm-layout/style/css.d.ts +0 -0
- package/lib/components/fm-layout/style/index.d.ts +0 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/packages/components/fm-layout/index.js +9 -0
- package/lib/packages/components/fm-layout/src/component/aside.vue.js +9 -0
- package/lib/packages/components/fm-layout/src/component/aside.vue2.js +179 -0
- package/lib/packages/components/fm-layout/src/component/columnsAside.vue.js +9 -0
- package/lib/packages/components/fm-layout/src/component/columnsAside.vue2.js +277 -0
- package/lib/packages/components/fm-layout/src/component/header.vue.js +9 -0
- package/lib/packages/components/fm-layout/src/component/header.vue2.js +54 -0
- package/lib/packages/components/fm-layout/src/component/main.vue.js +9 -0
- package/lib/packages/components/fm-layout/src/component/main.vue2.js +85 -0
- package/lib/packages/components/fm-layout/src/footer/index.vue.js +9 -0
- package/lib/packages/components/fm-layout/src/footer/index.vue2.js +33 -0
- package/lib/packages/components/fm-layout/src/index.vue.js +9 -0
- package/lib/packages/components/fm-layout/src/index.vue2.js +95 -0
- package/lib/packages/components/fm-layout/src/logo/index.vue.js +9 -0
- package/lib/packages/components/fm-layout/src/logo/index.vue2.js +61 -0
- package/lib/packages/components/fm-layout/src/main/classic.vue.js +9 -0
- package/lib/packages/components/fm-layout/src/main/classic.vue2.js +91 -0
- package/lib/packages/components/fm-layout/src/main/columns.vue.js +9 -0
- package/lib/packages/components/fm-layout/src/main/columns.vue2.js +104 -0
- package/lib/packages/components/fm-layout/src/main/defaults.vue.js +9 -0
- package/lib/packages/components/fm-layout/src/main/defaults.vue2.js +157 -0
- package/lib/packages/components/fm-layout/src/main/transverse.vue.js +9 -0
- package/lib/packages/components/fm-layout/src/main/transverse.vue2.js +74 -0
- package/lib/packages/components/fm-layout/src/navBars/index.vue.js +9 -0
- package/lib/packages/components/fm-layout/src/navBars/index.vue2.js +48 -0
- package/lib/packages/components/fm-layout/src/navBars/tagsView/contextmenu.vue.js +9 -0
- package/lib/packages/components/fm-layout/src/navBars/tagsView/contextmenu.vue2.js +160 -0
- package/lib/packages/components/fm-layout/src/navBars/tagsView/tagsView.vue.js +9 -0
- package/lib/packages/components/fm-layout/src/navBars/tagsView/tagsView.vue2.js +580 -0
- package/lib/packages/components/fm-layout/src/navBars/topBar/breadcrumb.vue.js +9 -0
- package/lib/packages/components/fm-layout/src/navBars/topBar/breadcrumb.vue2.js +173 -0
- package/lib/packages/components/fm-layout/src/navBars/topBar/index.vue.js +9 -0
- package/lib/packages/components/fm-layout/src/navBars/topBar/index.vue2.js +117 -0
- package/lib/packages/components/fm-layout/src/navBars/topBar/search.vue.js +9 -0
- package/lib/packages/components/fm-layout/src/navBars/topBar/search.vue2.js +124 -0
- package/lib/packages/components/fm-layout/src/navBars/topBar/upgradeInfo.vue.js +9 -0
- package/lib/packages/components/fm-layout/src/navBars/topBar/upgradeInfo.vue2.js +76 -0
- package/lib/packages/components/fm-layout/src/navBars/topBar/user.vue.js +9 -0
- package/lib/packages/components/fm-layout/src/navBars/topBar/user.vue2.js +703 -0
- package/lib/packages/components/fm-layout/src/navBars/topBar/userNews.vue.js +9 -0
- package/lib/packages/components/fm-layout/src/navBars/topBar/userNews.vue2.js +259 -0
- package/lib/packages/components/fm-layout/src/navMenu/horizontal.vue.js +9 -0
- package/lib/packages/components/fm-layout/src/navMenu/horizontal.vue2.js +186 -0
- package/lib/packages/components/fm-layout/src/navMenu/subItem.vue.js +9 -0
- package/lib/packages/components/fm-layout/src/navMenu/subItem.vue2.js +117 -0
- package/lib/packages/components/fm-layout/src/navMenu/vertical.vue.js +9 -0
- package/lib/packages/components/fm-layout/src/navMenu/vertical.vue2.js +163 -0
- package/lib/packages/components/fm-layout/src/routerView/iframes.vue.js +9 -0
- package/lib/packages/components/fm-layout/src/routerView/iframes.vue2.js +132 -0
- package/lib/packages/components/fm-layout/src/routerView/parent.vue.js +9 -0
- package/lib/packages/components/fm-layout/src/routerView/parent.vue2.js +145 -0
- package/lib/packages/components/fm-layout/src/type.js +2 -0
- package/lib/packages/components/index.js +14 -12
- package/locale/en.js +1 -1
- package/locale/en.min.js +1 -1
- package/locale/en.min.mjs +1 -1
- package/locale/en.mjs +1 -1
- package/locale/zh-cn.js +1 -1
- package/locale/zh-cn.min.js +1 -1
- package/locale/zh-cn.min.mjs +1 -1
- package/locale/zh-cn.mjs +1 -1
- package/package.json +1 -1
- package/theme-chalk/f-layout.css +1 -0
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/src/index.scss +1 -0
- package/theme-chalk/src/layout.scss +657 -0
- /package/es/{version.css → defaults.css} +0 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { defineComponent, defineAsyncComponent, reactive, computed, onMounted, watch, resolveComponent, openBlock, createBlock, withCtx, createElementBlock, Fragment, renderList, createVNode, unref, createCommentVNode, createElementVNode, toDisplayString, createSlots, withModifiers } from 'vue';
|
|
2
|
+
import { useRoute, onBeforeRouteUpdate } from 'vue-router';
|
|
3
|
+
import { storeToRefs } from 'pinia';
|
|
4
|
+
import '../../../../stores/index.mjs';
|
|
5
|
+
import other from '../../../../hooks/other.mjs';
|
|
6
|
+
import { useThemeConfig } from '../../../../stores/themeConfig.mjs';
|
|
7
|
+
|
|
8
|
+
const _hoisted_1 = ["onClick"];
|
|
9
|
+
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
10
|
+
__name: "vertical",
|
|
11
|
+
props: {
|
|
12
|
+
// 菜单列表
|
|
13
|
+
menuList: {
|
|
14
|
+
type: Array,
|
|
15
|
+
default: () => []
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
setup(__props) {
|
|
19
|
+
const SubItem = defineAsyncComponent(() => import('./subItem.vue.mjs'));
|
|
20
|
+
const props = __props;
|
|
21
|
+
const storesThemeConfig = useThemeConfig();
|
|
22
|
+
const { themeConfig } = storeToRefs(storesThemeConfig);
|
|
23
|
+
const route = useRoute();
|
|
24
|
+
const state = reactive({
|
|
25
|
+
// 修复:
|
|
26
|
+
defaultActive: route.meta.isDynamic ? route.meta.isDynamicPath : route.path,
|
|
27
|
+
isCollapse: false
|
|
28
|
+
});
|
|
29
|
+
const menuLists = computed(() => {
|
|
30
|
+
return props.menuList;
|
|
31
|
+
});
|
|
32
|
+
const getThemeConfig = computed(() => {
|
|
33
|
+
return themeConfig.value;
|
|
34
|
+
});
|
|
35
|
+
const setParentHighlight = (currentRoute) => {
|
|
36
|
+
const { path, meta } = currentRoute;
|
|
37
|
+
const pathSplit = (meta == null ? void 0 : meta.isDynamic) ? meta.isDynamicPath.split("/") : path.split("/");
|
|
38
|
+
if (pathSplit.length >= 4 && (meta == null ? void 0 : meta.isHide)) return pathSplit.splice(0, 3).join("/");
|
|
39
|
+
else return path;
|
|
40
|
+
};
|
|
41
|
+
const onALinkClick = (val) => {
|
|
42
|
+
other.handleOpenLink(val);
|
|
43
|
+
};
|
|
44
|
+
onMounted(() => {
|
|
45
|
+
state.defaultActive = setParentHighlight(route);
|
|
46
|
+
});
|
|
47
|
+
onBeforeRouteUpdate((to) => {
|
|
48
|
+
state.defaultActive = setParentHighlight(to);
|
|
49
|
+
const clientWidth = document.body.clientWidth;
|
|
50
|
+
if (clientWidth < 1e3) themeConfig.value.isCollapse = false;
|
|
51
|
+
});
|
|
52
|
+
watch(
|
|
53
|
+
() => themeConfig.value.isCollapse,
|
|
54
|
+
(isCollapse) => {
|
|
55
|
+
document.body.clientWidth <= 1e3 ? state.isCollapse = false : state.isCollapse = isCollapse;
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
immediate: true
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
return (_ctx, _cache) => {
|
|
62
|
+
const _component_SvgIcon = resolveComponent("SvgIcon");
|
|
63
|
+
const _component_el_sub_menu = resolveComponent("el-sub-menu");
|
|
64
|
+
const _component_el_menu_item = resolveComponent("el-menu-item");
|
|
65
|
+
const _component_el_menu = resolveComponent("el-menu");
|
|
66
|
+
return openBlock(), createBlock(_component_el_menu, {
|
|
67
|
+
router: "",
|
|
68
|
+
"default-active": state.defaultActive,
|
|
69
|
+
"background-color": "transparent",
|
|
70
|
+
collapse: state.isCollapse,
|
|
71
|
+
"unique-opened": getThemeConfig.value.isUniqueOpened,
|
|
72
|
+
"collapse-transition": false
|
|
73
|
+
}, {
|
|
74
|
+
default: withCtx(() => [
|
|
75
|
+
(openBlock(true), createElementBlock(
|
|
76
|
+
Fragment,
|
|
77
|
+
null,
|
|
78
|
+
renderList(menuLists.value, (val) => {
|
|
79
|
+
return openBlock(), createElementBlock(
|
|
80
|
+
Fragment,
|
|
81
|
+
null,
|
|
82
|
+
[
|
|
83
|
+
val.children && val.children.length > 0 ? (openBlock(), createBlock(_component_el_sub_menu, {
|
|
84
|
+
index: val.path,
|
|
85
|
+
key: val.path
|
|
86
|
+
}, {
|
|
87
|
+
title: withCtx(() => [
|
|
88
|
+
createVNode(_component_SvgIcon, {
|
|
89
|
+
name: val.meta.icon
|
|
90
|
+
}, null, 8, ["name"]),
|
|
91
|
+
createCommentVNode(" <span>{{ $t(val.meta.title) }}</span> "),
|
|
92
|
+
createElementVNode(
|
|
93
|
+
"span",
|
|
94
|
+
null,
|
|
95
|
+
toDisplayString(_ctx.$t(`message.menu.${val.meta.title}`)),
|
|
96
|
+
1
|
|
97
|
+
/* TEXT */
|
|
98
|
+
)
|
|
99
|
+
]),
|
|
100
|
+
default: withCtx(() => [
|
|
101
|
+
createVNode(unref(SubItem), {
|
|
102
|
+
chil: val.children
|
|
103
|
+
}, null, 8, ["chil"])
|
|
104
|
+
]),
|
|
105
|
+
_: 2
|
|
106
|
+
/* DYNAMIC */
|
|
107
|
+
}, 1032, ["index"])) : (openBlock(), createBlock(_component_el_menu_item, {
|
|
108
|
+
index: val.path,
|
|
109
|
+
key: val.path
|
|
110
|
+
}, createSlots({
|
|
111
|
+
default: withCtx(() => [
|
|
112
|
+
createVNode(_component_SvgIcon, {
|
|
113
|
+
name: val.meta.icon
|
|
114
|
+
}, null, 8, ["name"])
|
|
115
|
+
]),
|
|
116
|
+
_: 2
|
|
117
|
+
/* DYNAMIC */
|
|
118
|
+
}, [
|
|
119
|
+
!val.meta.isLink || val.meta.isLink && val.meta.isIframe ? {
|
|
120
|
+
name: "title",
|
|
121
|
+
fn: withCtx(() => [
|
|
122
|
+
createCommentVNode(" <span>{{ $t(val.meta.title) }}</span> "),
|
|
123
|
+
createElementVNode(
|
|
124
|
+
"span",
|
|
125
|
+
null,
|
|
126
|
+
toDisplayString(_ctx.$t(`message.menu.${val.meta.title}`)),
|
|
127
|
+
1
|
|
128
|
+
/* TEXT */
|
|
129
|
+
)
|
|
130
|
+
]),
|
|
131
|
+
key: "0"
|
|
132
|
+
} : {
|
|
133
|
+
name: "title",
|
|
134
|
+
fn: withCtx(() => [
|
|
135
|
+
createElementVNode("a", {
|
|
136
|
+
class: "w100",
|
|
137
|
+
onClick: withModifiers(($event) => onALinkClick(val), ["prevent"])
|
|
138
|
+
}, toDisplayString(_ctx.$t(`message.menu.${val.meta.title}`)), 9, _hoisted_1)
|
|
139
|
+
]),
|
|
140
|
+
key: "1"
|
|
141
|
+
}
|
|
142
|
+
]), 1032, ["index"]))
|
|
143
|
+
],
|
|
144
|
+
64
|
|
145
|
+
/* STABLE_FRAGMENT */
|
|
146
|
+
);
|
|
147
|
+
}),
|
|
148
|
+
256
|
|
149
|
+
/* UNKEYED_FRAGMENT */
|
|
150
|
+
))
|
|
151
|
+
]),
|
|
152
|
+
_: 1
|
|
153
|
+
/* STABLE */
|
|
154
|
+
}, 8, ["default-active", "collapse", "unique-opened"]);
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, watch, resolveDirective, openBlock, createElementBlock, createElementVNode, Fragment, renderList, withDirectives, createVNode, TransitionGroup, withCtx, unref, vShow, nextTick } from 'vue';
|
|
2
|
+
import { useRoute } from 'vue-router';
|
|
3
|
+
import '../../../../utils/index.mjs';
|
|
4
|
+
import { getToken } from '../../../../utils/request.mjs';
|
|
5
|
+
|
|
6
|
+
const _hoisted_1 = { class: "layout-padding layout-padding-unset layout-iframe" };
|
|
7
|
+
const _hoisted_2 = { class: "layout-padding-auto layout-padding-view" };
|
|
8
|
+
const _hoisted_3 = ["src", "data-url"];
|
|
9
|
+
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
10
|
+
__name: "iframes",
|
|
11
|
+
props: {
|
|
12
|
+
// 刷新 iframe
|
|
13
|
+
refreshKey: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: () => ""
|
|
16
|
+
},
|
|
17
|
+
// 过渡动画 name
|
|
18
|
+
name: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: () => "slide-right"
|
|
21
|
+
},
|
|
22
|
+
// iframe 列表
|
|
23
|
+
list: {
|
|
24
|
+
type: Array,
|
|
25
|
+
default: () => []
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
setup(__props) {
|
|
29
|
+
const props = __props;
|
|
30
|
+
const iframeRef = ref();
|
|
31
|
+
const route = useRoute();
|
|
32
|
+
const setIframeList = computed(() => {
|
|
33
|
+
return props.list.filter((v) => {
|
|
34
|
+
var _a;
|
|
35
|
+
return (_a = v.meta) == null ? void 0 : _a.isIframeOpen;
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
const getRoutePath = computed(() => {
|
|
39
|
+
return route.path;
|
|
40
|
+
});
|
|
41
|
+
const closeIframeLoading = (val, item) => {
|
|
42
|
+
nextTick(() => {
|
|
43
|
+
if (!iframeRef.value) return false;
|
|
44
|
+
iframeRef.value.forEach((v) => {
|
|
45
|
+
if (v.dataset.url === val) {
|
|
46
|
+
v.onload = () => {
|
|
47
|
+
var _a;
|
|
48
|
+
if (((_a = item.meta) == null ? void 0 : _a.isIframeOpen) && item.meta.loading) item.meta.loading = false;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
watch(
|
|
55
|
+
() => route.fullPath,
|
|
56
|
+
(val) => {
|
|
57
|
+
const item = props.list.find((v) => v.path === val);
|
|
58
|
+
if (!item) return false;
|
|
59
|
+
if (!item.meta.isIframeOpen) item.meta.isIframeOpen = true;
|
|
60
|
+
closeIframeLoading(val, item);
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
immediate: true
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
watch(
|
|
67
|
+
() => props.refreshKey,
|
|
68
|
+
() => {
|
|
69
|
+
const item = props.list.find((v) => v.path === route.path);
|
|
70
|
+
if (!item) return false;
|
|
71
|
+
if (item.meta.isIframeOpen) item.meta.isIframeOpen = false;
|
|
72
|
+
setTimeout(() => {
|
|
73
|
+
item.meta.isIframeOpen = true;
|
|
74
|
+
item.meta.loading = true;
|
|
75
|
+
closeIframeLoading(route.fullPath, item);
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
deep: true
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
return (_ctx, _cache) => {
|
|
83
|
+
const _directive_loading = resolveDirective("loading");
|
|
84
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
85
|
+
createElementVNode("div", _hoisted_2, [
|
|
86
|
+
(openBlock(true), createElementBlock(
|
|
87
|
+
Fragment,
|
|
88
|
+
null,
|
|
89
|
+
renderList(setIframeList.value, (v) => {
|
|
90
|
+
return withDirectives((openBlock(), createElementBlock("div", {
|
|
91
|
+
class: "w100",
|
|
92
|
+
key: v.path,
|
|
93
|
+
"element-loading-background": "white"
|
|
94
|
+
}, [
|
|
95
|
+
createVNode(TransitionGroup, { name: __props.name }, {
|
|
96
|
+
default: withCtx(() => [
|
|
97
|
+
withDirectives((openBlock(), createElementBlock("iframe", {
|
|
98
|
+
src: `${v.meta.isLink}${v.meta.isLink.indexOf("?") > 0 ? "&" : "?"}token=${unref(getToken)()}`,
|
|
99
|
+
key: v.path,
|
|
100
|
+
frameborder: "0",
|
|
101
|
+
height: "100%",
|
|
102
|
+
width: "100%",
|
|
103
|
+
style: { "position": "absolute" },
|
|
104
|
+
"data-url": v.path,
|
|
105
|
+
ref_for: true,
|
|
106
|
+
ref_key: "iframeRef",
|
|
107
|
+
ref: iframeRef
|
|
108
|
+
}, null, 8, _hoisted_3)), [
|
|
109
|
+
[vShow, getRoutePath.value === v.path]
|
|
110
|
+
])
|
|
111
|
+
]),
|
|
112
|
+
_: 2
|
|
113
|
+
/* DYNAMIC */
|
|
114
|
+
}, 1032, ["name"])
|
|
115
|
+
])), [
|
|
116
|
+
[_directive_loading, v.meta.loading]
|
|
117
|
+
]);
|
|
118
|
+
}),
|
|
119
|
+
128
|
|
120
|
+
/* KEYED_FRAGMENT */
|
|
121
|
+
))
|
|
122
|
+
])
|
|
123
|
+
]);
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { defineComponent, defineAsyncComponent, reactive, computed, onBeforeMount, nextTick, onMounted, onUnmounted, watch, resolveComponent, openBlock, createElementBlock, createVNode, withCtx, Transition, createBlock, KeepAlive, withDirectives, resolveDynamicComponent, vShow, unref } from 'vue';
|
|
2
|
+
import { useRoute, useRouter } from 'vue-router';
|
|
3
|
+
import { storeToRefs } from 'pinia';
|
|
4
|
+
import '../../../../stores/index.mjs';
|
|
5
|
+
import '../../../../utils/index.mjs';
|
|
6
|
+
import emitter from '../../../../utils/mitt.mjs';
|
|
7
|
+
import { useKeepALiveNames } from '../../../../stores/keepAliveNames.mjs';
|
|
8
|
+
import { useThemeConfig } from '../../../../stores/themeConfig.mjs';
|
|
9
|
+
import { Session } from '../../../../utils/storage.mjs';
|
|
10
|
+
|
|
11
|
+
const _hoisted_1 = { class: "layout-parent" };
|
|
12
|
+
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
13
|
+
__name: "parent",
|
|
14
|
+
setup(__props) {
|
|
15
|
+
const Iframes = defineAsyncComponent(() => import('./iframes.vue.mjs'));
|
|
16
|
+
const route = useRoute();
|
|
17
|
+
const router = useRouter();
|
|
18
|
+
const storesKeepAliveNames = useKeepALiveNames();
|
|
19
|
+
const storesThemeConfig = useThemeConfig();
|
|
20
|
+
const { keepAliveNames, cachedViews } = storeToRefs(storesKeepAliveNames);
|
|
21
|
+
const { themeConfig } = storeToRefs(storesThemeConfig);
|
|
22
|
+
const state = reactive({
|
|
23
|
+
refreshRouterViewKey: "",
|
|
24
|
+
// 非 iframe tagsview 右键菜单刷新时
|
|
25
|
+
iframeRefreshKey: "",
|
|
26
|
+
// iframe tagsview 右键菜单刷新时
|
|
27
|
+
keepAliveNameList: [],
|
|
28
|
+
iframeList: []
|
|
29
|
+
});
|
|
30
|
+
const setTransitionName = computed(() => {
|
|
31
|
+
return themeConfig.value.animation;
|
|
32
|
+
});
|
|
33
|
+
const getKeepAliveNames = computed(() => {
|
|
34
|
+
return themeConfig.value.isTagsview ? cachedViews.value : state.keepAliveNameList;
|
|
35
|
+
});
|
|
36
|
+
const isIframePage = computed(() => {
|
|
37
|
+
return route.meta.isIframe;
|
|
38
|
+
});
|
|
39
|
+
const getIframeListRoutes = async () => {
|
|
40
|
+
router.getRoutes().forEach((v) => {
|
|
41
|
+
if (v.meta.isIframe) {
|
|
42
|
+
v.meta.isIframeOpen = false;
|
|
43
|
+
v.meta.loading = true;
|
|
44
|
+
state.iframeList.push({ ...v });
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
onBeforeMount(() => {
|
|
49
|
+
state.keepAliveNameList = keepAliveNames.value;
|
|
50
|
+
emitter.on("onTagsViewRefreshRouterView", (fullPath) => {
|
|
51
|
+
var _a;
|
|
52
|
+
const cacheList = cachedViews.value;
|
|
53
|
+
if (route.meta.isKeepAlive) cachedViews.value = (_a = cachedViews.value) == null ? void 0 : _a.filter((name) => route.name !== name);
|
|
54
|
+
state.keepAliveNameList = keepAliveNames.value.filter((name) => route.name !== name);
|
|
55
|
+
state.refreshRouterViewKey = "";
|
|
56
|
+
state.iframeRefreshKey = "";
|
|
57
|
+
nextTick(() => {
|
|
58
|
+
if (route.meta.isKeepAlive) cachedViews.value = cacheList;
|
|
59
|
+
state.keepAliveNameList = keepAliveNames.value;
|
|
60
|
+
state.refreshRouterViewKey = fullPath;
|
|
61
|
+
state.iframeRefreshKey = fullPath;
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
onMounted(() => {
|
|
66
|
+
getIframeListRoutes();
|
|
67
|
+
nextTick(() => {
|
|
68
|
+
setTimeout(() => {
|
|
69
|
+
if (themeConfig.value.isCacheTagsView) {
|
|
70
|
+
let tagsViewArr = Session.get("tagsViewList") || [];
|
|
71
|
+
cachedViews.value = tagsViewArr.filter((item) => {
|
|
72
|
+
var _a;
|
|
73
|
+
return (_a = item.meta) == null ? void 0 : _a.isKeepAlive;
|
|
74
|
+
}).map((item) => item.name);
|
|
75
|
+
}
|
|
76
|
+
}, 0);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
onUnmounted(() => {
|
|
80
|
+
emitter.off("onTagsViewRefreshRouterView", () => {
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
watch(
|
|
84
|
+
() => route.fullPath,
|
|
85
|
+
() => {
|
|
86
|
+
state.refreshRouterViewKey = decodeURI(route.fullPath);
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
immediate: true
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
return (_ctx, _cache) => {
|
|
93
|
+
const _component_router_view = resolveComponent("router-view");
|
|
94
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
95
|
+
createVNode(_component_router_view, null, {
|
|
96
|
+
default: withCtx(({ Component }) => [
|
|
97
|
+
createVNode(Transition, {
|
|
98
|
+
name: setTransitionName.value,
|
|
99
|
+
mode: "out-in"
|
|
100
|
+
}, {
|
|
101
|
+
default: withCtx(() => [
|
|
102
|
+
(openBlock(), createBlock(KeepAlive, { include: getKeepAliveNames.value }, [
|
|
103
|
+
withDirectives((openBlock(), createBlock(resolveDynamicComponent(Component), {
|
|
104
|
+
key: state.refreshRouterViewKey,
|
|
105
|
+
class: "w100"
|
|
106
|
+
})), [
|
|
107
|
+
[vShow, !isIframePage.value]
|
|
108
|
+
])
|
|
109
|
+
], 1032, ["include"]))
|
|
110
|
+
]),
|
|
111
|
+
_: 2
|
|
112
|
+
/* DYNAMIC */
|
|
113
|
+
}, 1032, ["name"])
|
|
114
|
+
]),
|
|
115
|
+
_: 1
|
|
116
|
+
/* STABLE */
|
|
117
|
+
}),
|
|
118
|
+
createVNode(Transition, {
|
|
119
|
+
name: setTransitionName.value,
|
|
120
|
+
mode: "out-in",
|
|
121
|
+
persisted: ""
|
|
122
|
+
}, {
|
|
123
|
+
default: withCtx(() => [
|
|
124
|
+
withDirectives(createVNode(unref(Iframes), {
|
|
125
|
+
class: "w100",
|
|
126
|
+
refreshKey: state.iframeRefreshKey,
|
|
127
|
+
name: setTransitionName.value,
|
|
128
|
+
list: state.iframeList
|
|
129
|
+
}, null, 8, ["refreshKey", "name", "list"]), [
|
|
130
|
+
[vShow, isIframePage.value]
|
|
131
|
+
])
|
|
132
|
+
]),
|
|
133
|
+
_: 1
|
|
134
|
+
/* STABLE */
|
|
135
|
+
}, 8, ["name"])
|
|
136
|
+
]);
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|