Vue-form-wizard: 通过路由使选项卡索引动态化

3
我希望您能够通过 url 在选项卡之间进行导航。
选项卡内容属性route:我可以设置在 url 中显示的锚点。
表单向导属性start-index:我可以导航到正确的选项卡。
如何使start-index属性根据路由动态化,以便知道哪个索引?
这样我就可以在 url www.website.com/#a 转到选项卡索引 0,www.website.com/#b 转到选项卡索引 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>

你好,你找到解决方案了吗? - Rieljun Liguid
1个回答

0

奇怪的是设置起始索引似乎不起作用。

但你可以使用changeTab来设置选项卡,例如在mounted()中。

在那里你可以获取URL var currentUrl = window.location.pathname; 或者 var currentUrl = this.$route.query.page

然后使用以下代码切换到正确的标签页: this.$refs.wizard.changeTab(0, );


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接