有的人說添加@click后面? .native,我遇到的問題用這個方法并不行,最后解決辦法是在自定義組件內(nèi)把事件把點擊事件傳遞出去文章來源地址http://www.zghlxwxcb.cn/news/detail-513851.html
<!-- 自定義組件 -->
<template>
<view
@click="click"
class="icon svg-icon"
></view>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
export default defineComponent({
methods: {
click() {
// 點擊事件傳遞出去
this.$emit('click')
}
}
})
</script>
<!-- 使用自定義組件 -->
<icon-svg class="icon-addto" v-show="!content" @click="onClickAdd" />
文章來源:http://www.zghlxwxcb.cn/news/detail-513851.html
到了這里,關(guān)于Uniapp開發(fā)件微信小程序,自定義組件@click不起作用的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!