123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <template>
- <el-submenu
- ref="subMenu"
- :index="handlePath(item.path)"
- :popper-append-to-body="false"
- >
- <template slot="title">
- <vab-icon
- v-if="item.meta && item.meta.icon"
- :icon="['fas', item.meta.icon]"
- class="vab-fas-icon"
- />
- <vab-remix-icon
- v-if="item.meta && item.meta.remixIcon"
- :icon-class="item.meta.remixIcon"
- class="vab-remix-icon"
- />
- <span>{{ item.meta.title }}</span>
- </template>
- <slot></slot>
- </el-submenu>
- </template>
- <script>
- import { isExternal } from "@/utils/validate";
- import path from "path";
- export default {
- name: "Submenu",
- props: {
- routeChildren: {
- type: Object,
- default() {
- return null;
- },
- },
- item: {
- type: Object,
- default() {
- return null;
- },
- },
- fullPath: {
- type: String,
- default: "",
- },
- },
- methods: {
- handlePath(routePath) {
- if (isExternal(routePath)) {
- return routePath;
- }
- if (isExternal(this.fullPath)) {
- return this.fullPath;
- }
- return path.resolve(this.fullPath, routePath);
- },
- },
- };
- </script>
|