具有相同组件的路线中的静态道具

时间:2019-12-10 11:59:01

标签: vue.js routes vue-router

我对静态道具对象有疑问。我将这段代码放入route.js

const TableMjPage = () => import ('pages/MyPrj/TableComponent')
export default [{
  path: '/app',
  name: 'home',
  label: 'home',
  icon: 'el-icon-setting',
  redirect: {
    name: 'menu.company'
  },
  component: require('pages/MyPrj/MainPage').default,
  showInMenu: false,
  children: [{
    path: 'company',
    name: 'menu.company',
    label: 'Company',
    icon: 'el-icon-s-management',
    component: TableMjPage,
    props: {
      keyModel: 'company'
    },
    showInMenu: true,
    children: [{
      path: 'agenda',
      name: 'menu.agenda',
      label: 'Agenda',
      component: TableMjPage,
      props: {
        keyModel: 'agenda'
      }
    }]
  }, {
    path: 'settings',
    name: 'menu.settings',
    label: 'Settings',
    icon: 'el-icon-setting',
    component: TableMjPage,
    showInMenu: true,
    props: {
      keyModel: 'setting'
    },
    children: [{
      path: 'setting1',
      name: 'menu.setting1',
      title: 'Settings 1',
      icon: 'el-icon-setting',
      props: {
        keyModel: 'setting1'
      }
    }]
  }]
}, {
  path: '*',
  redirect: '/welcome'
}]

当我初始化对象并更改路线时,道具不会更新,而总是在路线上设置名称为“ menu.company”

为什么呢?

预先感谢

0 个答案:

没有答案