当前位置:网站首页>Vant3 - click on the corresponding name name to jump to the next page corresponding to the location of the name of the TAB bar
Vant3 - click on the corresponding name name to jump to the next page corresponding to the location of the name of the TAB bar
2022-08-04 00:35:00 【Nanchen_42】
Vant—— tab 点击对应的nameThe name jumps to the corresponding one on the next pagetab栏的name的位置
First of all, we need to configure the corresponding data structure for the previous page
这里是通过Pinia去写 ️
myfileStore.ts
<div v-for="(item,index) in store.list" :key="index" @click="onList(item,index)"></div>
const onList = (item: any, index: Number) => {
router.push({
// path: "/IndexFill",
path: item.path,
query:{
name:item.name // put the clickedname传给下一个页面
}
});
};
IndexFill.vue
/* 这里需要把activeNameBind as in the previous pagequery中的name的值 */
<van-tabs v-model:active="activeName" swipeable @change="change">
/* 通过动态nameto get the traverseditem.name即可 */
<van-tab v-for="(item,index) in store.list" :name="item.name" :title="item.title" :key="index">
</van-tab>
</van-tabs>
<script lang='ts'>
import {
useRoute } from "vue-router";
import {
onMounted, ref } from "vue";
import {
myfileStore } from "../store/module/myfileStore"; // Deconstruction just putPinia中的store
export default {
name: "",
setup() {
const store = myfileStore();
const route = useRoute();
const name = route.query;
/* 直接通过refGenerate initializedactiveName */
const activeName = ref(name.name);
// console.log(activeName)
/* vant的滑动事件 */
const change = (name: any) => {
console.log(name);
};
return {
change,
onClickLeft,
activeName,
store,
route,
name,
};
},
};
</script>
A little attention to the dynamic herenameThe list in which to bind the loopname
边栏推荐
猜你喜欢
typescript53 - generic constraints
数据库扩容也可以如此丝滑,MySQL千亿级数据生产环境扩容实战
共享新能源充电桩充电站建设需要些什么流程及资料?
轻量级网络整理及其在Yolov5上的实现
What warehouse management problems can WMS warehouse management system solve in the electronics industry?
typescript48-函数之间的类型兼容性
2022-08-03:以下go语言代码输出什么?A:2;B:3;C:1;D:0。 package main import “fmt“ func main() { slice := []i
Eight things to pay attention to in spot silver
如何通过单步调试的方式找到引起 Fiori Launchpad 路由错误的原因试读版
Web3 security risks daunting?How should we respond?
随机推荐
状态机实验
关于mnn模型输出的数据杂乱无章问题
Read FastDFS in one article
虚拟机CentOS7中无图形界面安装Oracle
2015年开源大事件汇总
typescript57-数组泛型接口
2022-08-03:以下go语言代码输出什么?A:2;B:3;C:1;D:0。 package main import “fmt“ func main() { slice := []i
typescript55 - generic constraints
一文参透分布式存储系统Ceph的架构设计、集群搭建(手把手)
Analysis: What makes the Nomad Bridge hack unique
带你造轮子,自定义一个随意拖拽可吸边的悬浮View组件
C语言实验十四 结构体
Node.js的基本使用(三)数据库与身份认证
MATLAB三维绘图命令plot3入门
C # WPF equipment monitoring software (classic) - the next
Shell编程之循环语句(for、while)
Nanoprobes 棕榈酰纳米金相关说明书
typescript48 - type compatibility between functions
RSS订阅微信公众号初探-feed43
伦敦银最新均线分析系统怎么操作?