小程序
小游戏
企业微信
微信支付
扫描小程序码分享
绑定一个点击事件
js如下
编译报错
大神求助~~~~~~~~
8 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
bindtap='aa',不要加括号
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
页面:
<li><a class="tab_head on" id="goods_ka1" bindtap="setGoodsTab()">商品</a></li>
js:
var app = getApp()
Page({
data: {
char_lt: "<",
motto: 'MiHome_Store',
userInfo: {},
indicatorDots: true,
autoplay: true,
interval: 3000,
duration: 100,
show_flag: false,
"banner_list": [
{
"banner": [
"pic_url": "http://static.home.mi.com/app/shop/img?id=shop_904608692a4d8415d0de39a0a5897e80.jpeg&w=1080&h=600&crop=a_0_120_1080_480&t=webp&z=1.15&q=78",
},
"pic_url": "http://static.home.mi.com/app/shop/img?id=shop_0f5e43035a8b8d27a4b6f315d222fd9b.jpeg&w=1080&h=600&crop=a_0_120_1080_480&t=webp&z=1.15&q=78",
"pic_url": "http://static.home.mi.com/app/shop/img?id=shop_4ba3d814639ab27570f174467133619f.png&w=1080&h=600&crop=a_0_120_1080_480&t=webp&z=1.15&q=78",
"pic_url": "http://static.home.mi.com/app/shop/img?id=shop_91f29509f14ea243958285aaf5d5b640.jpeg&w=1080&h=600&crop=a_0_120_1080_480&t=webp&z=1.15&q=78",
"pic_url": "http://static.home.mi.com/app/shop/img?id=shop_5c752db8097555831469356f5f389078.jpeg&w=1080&h=600&crop=a_0_120_1080_480&t=webp&z=1.15&q=78",
}
]
"pic_url": "http://static.home.mi.com/app/shop/img?id=shop_3237b46c5de819816125d88e9d06b7bf.jpg&crop=a_0_120_1080_480&t=webp&z=1.15&q=78",
"pic_url": "http://static.home.mi.com/app/shop/img?id=shop_c02bce3048058edb194dc3efb230d06b.jpg&crop=a_0_120_1080_480&t=webp&z=1.15&q=78",
"pic_url": "http://static.home.mi.com/app/shop/img?id=shop_45b3c9ed56aef44994176b50ae5d8a69.jpg&crop=a_0_120_1080_480&t=webp&z=1.15&q=78",
"pic_url": "http://static.home.mi.com/app/shop/img?id=shop_95583f54ee857e8fa5f4cf1b9f791a74.jpg&crop=a_0_120_1080_480&t=webp&z=1.15&q=78",
],
onPageScroll: function (e) {
var that=this;
if (e.scrollTop >= 485){
that.setData({
show_flag: true
})
}else{
show_flag: false
setGoodsTab:function(){
console.log("aa");
onLoad: function () {
。。。。,看你修改完后的页面和js,我看看你是不是哪里写错了
Do not have setGoodsTab() handler in current page: pages/details/index. Please make sure that setGoodsTab() handler has been defined in pages/details/index, or pages/details/index has been added into app.json
你改了之后的
看看截图
不行,一样的错误
可能小程序不支持 bindtap="方法名(参数)",你把参数去掉,先赋死值看一下可以吗
因为我一般赋值都是用data-名称的
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
bindtap='aa',不要加括号
页面:
<li><a class="tab_head on" id="goods_ka1" bindtap="setGoodsTab()">商品</a></li>
js:
var app = getApp()
Page({
data: {
char_lt: "<",
motto: 'MiHome_Store',
userInfo: {},
indicatorDots: true,
autoplay: true,
interval: 3000,
duration: 100,
show_flag: false,
"banner_list": [
{
"banner": [
{
"pic_url": "http://static.home.mi.com/app/shop/img?id=shop_904608692a4d8415d0de39a0a5897e80.jpeg&w=1080&h=600&crop=a_0_120_1080_480&t=webp&z=1.15&q=78",
},
{
"pic_url": "http://static.home.mi.com/app/shop/img?id=shop_0f5e43035a8b8d27a4b6f315d222fd9b.jpeg&w=1080&h=600&crop=a_0_120_1080_480&t=webp&z=1.15&q=78",
},
{
"pic_url": "http://static.home.mi.com/app/shop/img?id=shop_4ba3d814639ab27570f174467133619f.png&w=1080&h=600&crop=a_0_120_1080_480&t=webp&z=1.15&q=78",
},
{
"pic_url": "http://static.home.mi.com/app/shop/img?id=shop_91f29509f14ea243958285aaf5d5b640.jpeg&w=1080&h=600&crop=a_0_120_1080_480&t=webp&z=1.15&q=78",
},
{
"pic_url": "http://static.home.mi.com/app/shop/img?id=shop_5c752db8097555831469356f5f389078.jpeg&w=1080&h=600&crop=a_0_120_1080_480&t=webp&z=1.15&q=78",
}
]
},
{
"banner": [
{
"pic_url": "http://static.home.mi.com/app/shop/img?id=shop_3237b46c5de819816125d88e9d06b7bf.jpg&crop=a_0_120_1080_480&t=webp&z=1.15&q=78",
},
{
"pic_url": "http://static.home.mi.com/app/shop/img?id=shop_c02bce3048058edb194dc3efb230d06b.jpg&crop=a_0_120_1080_480&t=webp&z=1.15&q=78",
},
{
"pic_url": "http://static.home.mi.com/app/shop/img?id=shop_45b3c9ed56aef44994176b50ae5d8a69.jpg&crop=a_0_120_1080_480&t=webp&z=1.15&q=78",
},
{
"pic_url": "http://static.home.mi.com/app/shop/img?id=shop_95583f54ee857e8fa5f4cf1b9f791a74.jpg&crop=a_0_120_1080_480&t=webp&z=1.15&q=78",
}
]
}
],
},
onPageScroll: function (e) {
var that=this;
if (e.scrollTop >= 485){
that.setData({
show_flag: true
})
}else{
that.setData({
show_flag: false
})
}
},
setGoodsTab:function(){
console.log("aa");
},
onLoad: function () {
}
})
。。。。,看你修改完后的页面和js,我看看你是不是哪里写错了
Do not have setGoodsTab() handler in current page: pages/details/index. Please make sure that setGoodsTab() handler has been defined in pages/details/index, or pages/details/index has been added into app.json
你改了之后的
看看截图
不行,一样的错误
可能小程序不支持 bindtap="方法名(参数)",你把参数去掉,先赋死值看一下可以吗
因为我一般赋值都是用data-名称的