javascript - 标签页切换,下一步需要保留未点击的页面
问题描述
如果单击 tab1,然后单击下一步按钮,则页面将为 tabPage3,但 tab2 必须保持为 tabPage2。当您在 tab3 页面上单击返回按钮时,它将返回到 tab1Page。
然后点击tab2,再点击next按钮,页面会是tab3Page,点击tab3页面中的back按钮返回tab2Page。
我怎样才能实现它?
<div class="d-flex justify-content-between title">
<div class="shop-title" @click="currentTab = 0" :class="{active: currentTab === 0}">tab1</div>
<div class="shop-title" @click="currentTab = 1" :class="{active: currentTab === 1}">tab2</div>
</div>
<div class="tab1Page" v-show="currentTab === 0">
tab1Page
</div>
<div class="tab2Page" v-show="currentTab === 1">
tab2Page
</div>
<div class="tab3Page">
tab3Page
<button>back</button>
</div>
<button>next</button>
<script>
export default {
name: "",
props: {},
data: function () {
return {
actives: false,
currentTab: 0,
};
},
methods: {
active(index) {
this.actives = index;
},
next() {
if(currentTab === 0){
$(.tab1).hide()
$(.tab3).show()
}
})
}
},
};
</script>
<style>
.title {
width: 300px;
background: #000;
color: #fff;
padding: 10px 60px;
}
.shop-title.active {
background: #ccc;
}
.tab3{
display: none;
}
</style>
解决方案
推荐阅读
- linux - 如何让 wine 识别 dll 文件?
- ajax - 如何使用下面的代码使用 ajax 调用此表单
- javascript - 如何访问要从中提取数据的网站的控制台?
- reporting - 在 BlueSky Statistics 中,如何删除输出窗口中的分析?
- c# - Unity:发布请求无法连接到目标主机
- excel - 在 lineChart excel 图中添加和查看 dataLabels (CTDLbls)
- teradata - Teradata:连续季度排名。
- python - 需要python中这个字符串的正则表达式吗?
- json - 可以/应该在带引号的json中传递布尔值吗?
- javascript - “in”运算符在 IE11 中无法按预期使用日期字符串