路由params跳转并在跳转后的页面默认打开el-tree

2019-12-21  本文已影响0人  Hello杨先生
       {path: 'know/knowledgeArticle/:routerKnowledgeid',name:'knowledgeArticle',component: () => import('../view/know/knowledgeArticle'), meta: {title: '通行宝EAAS客服运营平台', des: '文章',funCode:'m9-1'}},

routerKnowledgeid:[],  //到article页面的唯一标识
console.log('路由带参knowledgeid获取的参数routerKnowledgeid',this.$route.params.routerKnowledgeid)
this.routerKnowledgeid.splice(0,this.routerKnowledgeid.length)
this.routerKnowledgeid.push(this.$route.params.routerKnowledgeid)
        this.routerKnowledgeid.splice(0,this.routerKnowledgeid.length)
        if (!!data.knowledgeid)  {
          this.routerKnowledgeid.push(data.routerKnowledgeid)
          this.$router.push({name:'knowledgeArticle',params:{label:data.routerKnowledgeid}})
        }

 this.$router.push({name:'knowledgeArticle',params:{routerKnowledgeid: .knowledgeid}})

          <el-tree
            accordion
            :data="parent"
            highlight-current
            @node-click="handleNodeClick"
            node-key="knowledgeid"
            :default-expanded-keys="routerKnowledgeid"
            :default-checked-keys="routerKnowledgeid"
          >
            <!--            node-key="label"-->
            <!--            :default-expanded-keys="label"-->
            <!--            :default-checked-keys="label"-->
            <span  slot-scope="{ node, data }" style="font-size:14px;font-weight:500;color:#444444;">
                <span style="display:inline-block;width:150px;overflow: hidden;text-overflow:ellipsis;white-space: nowrap;" >
<!--                  {{ node.label }}{{node.created}}-->
                  {{ node.label }}
                </span>
              </span>
          </el-tree>

上一篇 下一篇

猜你喜欢

热点阅读