Vue-form-wizard:使标签索引按路线动态

时间:2019-04-11 10:42:26

标签: javascript html vue.js tabs

我想按网址在标签中导航。

标签内容道具route:我可以设置显示在网址中的锚点。

表单向导道具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>

1 个答案:

答案 0 :(得分:0)

奇怪地设置起始索引似乎无效。

但是您可以使用changeTab设置选项卡,例如在mount()中。

您可以在其中找到网址 var currentUrl = window.location.pathname; 要么 var currentUrl = this。$ route.query.page

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