huangbin пре 4 година
родитељ
комит
2305e59f35

+ 2 - 2
src/router/index.ts

@@ -80,7 +80,7 @@ const routes: Array<RouteRecordRaw> = [
                 children: [
                     {
                         path: '/goods_info/spot',
-                        name: EnumType.GoodsInfo.spot,
+                        name: 'goods_info_spot',
                         component: () => import('@/views/information/goods/list/spot-variety/index.vue'),
                         meta: {
                             requireAuth: true
@@ -88,7 +88,7 @@ const routes: Array<RouteRecordRaw> = [
                     },
                     {
                         path: '/goods_info/hedging',
-                        name: EnumType.GoodsInfo.hedging,
+                        name: 'goods_info_hedge',
                         component: () => import('@/views/information/goods/list/hedging-variety/index.vue'),
                         meta: {
                             requireAuth: true

+ 1 - 1
src/setup/router/index.ts

@@ -25,7 +25,7 @@ function mateRouter(router: Router) {
     return result
 }
 
-export function handleMenu() {
+export function handleRouterMenu() {
     const router = useRouter();
     const list = ref<OperationTabMenu[]>([])
     // 获取动态路由

+ 2 - 5
src/views/information/custom/index.vue

@@ -11,11 +11,8 @@
 <script lang="ts">
 import { defineComponent, ref } from 'vue';
 import firstMenu from '@/components/firstMenu/index.vue';
-import { useRouter } from 'vue-router';
-import { CustomInfo } from '@/enums/routerName';
 import { initData } from '@/setup/methods/index';
-import { handleMenu } from '@/setup/router/index';
-import { OperationTabMenu } from '@/goServiceAPI/commonService/interface';
+import { handleRouterMenu } from '@/setup/router/index';
 
 export default defineComponent({
     name: 'custom',
@@ -23,7 +20,7 @@ export default defineComponent({
         firstMenu,
     },
     setup() {
-        const { list, selectMenu, getMenuList } = handleMenu();
+        const { list, selectMenu, getMenuList } = handleRouterMenu();
         initData(() => {
             getMenuList();
             console.log('list', list);

+ 8 - 17
src/views/information/goods/index.vue

@@ -2,7 +2,7 @@
   <!-- 商品信息 -->
   <div class="goods-info">
     <firstMenu :list="list"
-               :value="'value'"
+               :value="'title'"
                @selectMenu="selectMenu" />
     <router-view />
   </div>
@@ -11,21 +11,8 @@
 <script lang="ts">
 import { defineComponent } from 'vue';
 import firstMenu from '@/components/firstMenu/index.vue';
-import { useRouter } from 'vue-router';
-import { GoodsInfo } from '@/enums/routerName';
-
-// 处理菜单
-function handleMenu() {
-    const router = useRouter();
-    const list = [
-        { key: GoodsInfo.spot, value: '现货品种' },
-        { key: GoodsInfo.hedging, value: '套保品种' },
-    ];
-    function selectMenu(item: any) {
-        router.push({ name: item.key });
-    }
-    return { list, selectMenu };
-}
+import { handleRouterMenu } from '@/setup/router/index';
+import { initData } from '@/setup/methods/index';
 
 export default defineComponent({
     name: 'custom',
@@ -33,7 +20,11 @@ export default defineComponent({
         firstMenu,
     },
     setup() {
-        const { list, selectMenu } = handleMenu();
+        const { list, selectMenu, getMenuList } = handleRouterMenu();
+        initData(() => {
+            getMenuList();
+            console.log('list', list);
+        });
         return { list, selectMenu };
     },
 });