uniapp中绑定点击事件
时间: 2023-10-07 11:08:02 浏览: 293
在uni-app中,可以使用v-on指令来绑定点击事件。具体做法是在需要绑定点击事件的元素上添加v-on:click属性,并将其值设置为一个方法名。当该元素被点击时,对应的方法会被调用。例如,给一个按钮绑定点击事件的代码如下所示:
<template>
<view>
<button type="primary" v-on:click="clickHandle()">按钮</button>
</view>
</template>
<script>
export default {
data() {
return {}
},
methods: {
clickHandle() {
console.log('点击我了')
}
}
}
</script>
<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [uni-app双击事件(单击、双击互不干扰)](https://blog.csdn.net/qq_44046765/article/details/114582406)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [解决vue 绑定对象内点击事件失效问题](https://download.csdn.net/download/weixin_38516863/12952799)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [uniapp 绑定事件](https://blog.csdn.net/weixin_57607714/article/details/118520251)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文