当前位置:网站首页>微信小程序 catchtap=“toDetail“ 事件问题
微信小程序 catchtap=“toDetail“ 事件问题
2022-04-23 07:21:00 【Accpdaiyekun】
const app = getApp()
const util = require('/../../../utils/util.js')
Component({
options: {
addGlobalClass: true //一定要加这句话,不然没样式
},
data: {
tbaseurl:app.globalData.apiUrl,
cardCur: 0,
isCard:false,
swiperList: [{
id: 0,
type: 'image',
url: app.globalData.apiUrl + 'Uploads/homeimg/img001.jpg'
}, {
id: 1,
type: 'image',
url: app.globalData.apiUrl + 'Uploads/homeimg/img002.jpg'
}, {
id: 2,
type: 'image',
url: app.globalData.apiUrl + 'Uploads/homeimg/img003.jpg'
}, {
id: 3,
type: 'image',
url: app.globalData.apiUrl + 'Uploads/homeimg/img004.jpg'
}, {
id: 4,
type: 'image',
url: app.globalData.apiUrl + 'Uploads/homeimg/img005.jpg'
}, {
id: 5,
type: 'image',
url: app.globalData.apiUrl + 'Uploads/homeimg/img006.jpg'
}, {
id: 6,
type: 'image',
url: app.globalData.apiUrl + 'Uploads/homeimg/img007.jpg'
}],
toplists:[]//文案
},
methods: {
GetWan: function () {
var that=this;
wx.request({
url: app.globalData.apiUrl + 'WxXcx/XcxWn/GetListTopNum',
data: {
LoginKey: wx.getStorageSync('loginKey'),
},
method: 'GET',
header: {
'content-type': 'application/json'
},
success: function (res) {
//debugger;
var tempdata=res.data.data;
that.setData({
toplists:tempdata
})
}
})
},
toDetail(e) {//跳转详情页
var currid = e.currentTarget.dataset.currid; //获取下标
//获取标题
wx.navigateTo({
//保留本页面,跳转到另一个页面
url: '/pages/component/Document/detail?Id=' + currid, //页面跳转 url+值
})
}
},
lifetimes: {
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名 相当于page onload
attached: function () {
// debugger;
this.GetWan();
}, //相当于page里的onLoad
moved: function () {},
detached: function () {},
},
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
ready: function () {
},
pageLifetimes: {
show() {
}
},
})
component 组件下catchtap 事件 问题。
解决问题是 methods 放toDetail 方法就可以
版权声明
本文为[Accpdaiyekun]所创,转载请带上原文链接,感谢
https://blog.csdn.net/Accpdaiyekun/article/details/124300265
边栏推荐
- JS converts tree structure data into one-dimensional array data
- 欧圣电气深交所上市:市值52亿 陆为东父女为美国籍
- Qt编译QtXlsx库
- 【Appium】测试时遇到手机内嵌H5页面的切换问题
- Compiling principle questions - with answers
- Campus transfer second-hand market source code download
- Somme numérique de la chaîne de calcul pour un problème simple de leetcode
- The simple problem of leetcode is to calculate the numerical sum of strings
- PHP generates short links: convert numbers to letters and letters to numbers
- Ubuntu安装Mysql并查询平均成绩
猜你喜欢
谈谈那些基础但不简单的股票数据
LeetCode簡單題之計算字符串的數字和
每周leetcode - 06 数组专题 7~739~50~offer 62~26~189~9
thinkphp6+jwt 实现登录验证
My heart's broken! A woman's circle of friends envied others for paying wages on time and was fired. Even her colleagues who liked her were fired together
一篇文章看懂变量提升(hoisting)
PyQt5开发之QTableWidget表头自定义与美化(附源代码下载)
Brief description of CPU
clang 如何产生汇编文件
Vowel substring in statistical string of leetcode simple problem
随机推荐
单点登录 SSO
Canvas learning Chapter 1
Common regular expressions
每周leetcode - 06 数组专题 7~739~50~offer 62~26~189~9
编译原理题-带答案
情境领导者-第七章、解决绩效问题
PHP high precision computing
Thinkphp6 + JWT realizes login verification
Compiling principle questions - with answers
[appium] encountered the problem of switching the H5 page embedded in the mobile phone during the test
岛屿的个数
扎心了!一女子发朋友圈羡慕别人按时发工资被开除,连点赞的同事也一同被开除了...
Discussion on ES6 tail tune optimization
Qt利用QtXlsx操作excel文件
vslam PPT
Comparison of indoor positioning technology
Quick rehearsal exercise
The simple problem of leetcode is to calculate the numerical sum of strings
[untitled]
5.6 综合案例-RTU-