Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wepy使用vant 的 tabs 组件,事件click传参找不到 #2811

Open
UNIONDONG opened this issue Sep 8, 2022 · 0 comments
Open

wepy使用vant 的 tabs 组件,事件click传参找不到 #2811

UNIONDONG opened this issue Sep 8, 2022 · 0 comments

Comments

@UNIONDONG
Copy link

使用wepy+vant-tabs组件,调用click接口一直找不到传递的参数,不太清楚哪里的问题,希望大家帮忙一下

vant-tabs的案例如下:

<van-tabs bind:click="onClick">
  <van-tab title="标签 1">内容 1</van-tab>
  <van-tab title="标签 2">内容 2</van-tab>
</van-tabs>
Page({
  onClick(event) {
    wx.showToast({
      title: `点击标签 ${event.detail.name}`,
      icon: 'none',
    });
  },
});

我的在原生微信小程序可运行,但是移植wepy后,找不到传递回来的参数,帮帮忙 拜托了大家


<van-tabs sticky bind:click="tab_choose" line-width="110rpx" color="#ff8000">
	<van-tab title="最近热门"></van-tab>
</van-tabs>

tab_choose(event, type_name) {
	//获取要查询的资源类型
	console.log(event);
	console.log(type_name)
	var tabTitle = event.detail.title;
	this.getResources(tabTitle);    //查询类别下的所有资源
},

<config>
{
  "navigationBarTitleText": "移步资源库",
  "usingComponents": {
	  	"van-button": "module:@vant/weapp/dist/button/index",
	  	"van-tab": "module:@vant/weapp/dist/tab/index",
	  	"van-tabs": "module:@vant/weapp/dist/tabs/index",
	  	"van-grid": "module:@vant/weapp/dist/grid/index",
		"van-toast": "module:@vant/weapp/dist/grid/index",
	  	"van-grid-item": "module:@vant/weapp/dist/grid-item/index",
	  	"van-notice-bar": "module:@vant/weapp/dist/notice-bar/index"

  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant