当前位置:网站首页>微信小程序 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
边栏推荐
- Talk about the basic but not simple stock data
- 简述CPU
- mysql查询字符串类型的字段使用数字类型查询时问题
- [go] common concurrency model [generic version]
- 校园转转二手市场源码下载
- PHP generates short links: convert numbers to letters and letters to numbers
- 数据的删除和修改操作(mysql)
- Comparison of indoor positioning technology
- Rotation function of leetcode medium problem
- 为什么会存在1px问题?怎么解决?
猜你喜欢

简述CPU

Qt读写XML文件

Why are there 1px problems? How?

LeetCode簡單題之計算字符串的數字和

欧圣电气深交所上市:市值52亿 陆为东父女为美国籍

搜一下导航完整程序源码

Community group purchase applet source code + interface DIY + nearby leader + supplier + group collage + recipe + second kill + pre-sale + distribution + live broadcast

Comparison of indoor positioning methods of several intelligent robots

Smart business card applet business card details page function implementation key code

【学习】从零开始的音视频开发(9)——NuPlayer
随机推荐
Transformer-XL: Attentive Language ModelsBeyond a Fixed-Length Context 论文总结
在MATLAB中快速画圆(给出圆心坐标和半径就能直接画的那种)
PyQt5开发之QTableWidget表头自定义与美化(附源代码下载)
3C装配中的机械臂运动规划
Smart business card applet business card details page function implementation key code
mysql查询字符串类型的字段使用数字类型查询时问题
2022.4.11-4.17 AI industry weekly (issue 93): the dilemma of AI industry
Implementation of promise all
有意思的js 代码
【学习】从零开始的音视频开发(9)——NuPlayer
Thinkphp6 + JWT realizes login verification
[go]常见的并发模型[泛型版]
ASAN 极简原理
一篇文章看懂变量提升(hoisting)
C language learning record -- use and analysis of string function (2)
Interesting JS code
Draw a circle quickly in MATLAB (the one that can be drawn directly given the coordinates and radius of the center of the circle)
欧圣电气深交所上市:市值52亿 陆为东父女为美国籍
WordPress love navigation theme 1.1.3 simple atmosphere website navigation source code website navigation source code
Online app resource download website source code