【问题标题】:Vue-form-wizard: Make the tab index dynamic by the routeVue-form-wizard:通过路由使标签索引动态化
【发布时间】:2019-09-01 23:25:10
【问题描述】:

我想通过 url 在标签中导航。

Tab-content prop route:我可以设置一个显示在 url 中的锚点。

Form-wizard prop start-index:我可以导航到右侧标签。

我怎样才能使start-index 属性动态地设置在哪个索引的路径上?

所以我可以输入网址 www.website.com/#a 进入 tabindex 0 和 www.website.com/#b 进入 tabindex 1

包: vue-form-wizard

 <form-wizard :start-index="1">
   <tab-content title="a" route="#a">
     <p>a</p>
   </tab-content>

   <tab-content title="b" route="#b">
     <p>b</p>
   </tab-content>
 </form-wizard>

【问题讨论】:

  • 嗨,你找到解决办法了吗?

标签: javascript html vue.js tabs


【解决方案1】:

奇怪地设置 start-index 似乎不起作用。

但是你可以使用changeTab来设置标签,例如在mounted()中。

在那里你可以得到网址 var currentUrl = window.location.pathname; 要么 var currentUrl = this.$route.query.page

然后使用 this.$refs.wizard.changeTab(0, );

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-06-01
    • 2021-05-21
    • 1970-01-01
    • 1970-01-01
    • 2020-07-30
    • 2019-12-05
    • 2017-11-24
    • 2019-08-28
    相关资源
    最近更新 更多