We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
如下代码所示,tapItem 传入的参数 index 会是 undefined,但是 <view>{{ index }}</view> 却能获取到值。
tapItem
index
undefined
<view>{{ index }}</view>
<view v-for="item in array"> <view>{{ index }}</view> <view @tap="tapItem(index)"></view> </view>
如果这个在上面代码的基础下在 v-for 中显示声明循环的索引 index,如下图代码。那么 tapItem 就能正常获取到参数 index 的值。
v-for
<view v-for="(item, index) in array"> <view>{{ index }}</view> <view @tap="tapItem(index)"></view> </view>
所以这应该是框架的一个 bug。
bug
The text was updated successfully, but these errors were encountered:
通过查看编译后的代码发现,在事件中引用的参数会将 参数值 存储在 data-wpytap-a 等属性上。
data-wpytap-a
在例一中:
{{index}}
所以使用例二的写法就可以了
Sorry, something went wrong.
必须显示声明 index
No branches or pull requests
如下代码所示,
tapItem
传入的参数index
会是undefined
,但是<view>{{ index }}</view>
却能获取到值。如果这个在上面代码的基础下在
v-for
中显示声明循环的索引index
,如下图代码。那么tapItem
就能正常获取到参数index
的值。所以这应该是框架的一个
bug
。The text was updated successfully, but these errors were encountered: