代碼
<template>
<view>
<button @click="open">打開彈窗</button>
<uni-popup ref="popup" type="bottom">底部彈出 Popup</uni-popup>
</view>
</template>
<script>
export default {
methods:{
open(){
// 通過組件定義的ref調(diào)用uni-popup方法 ,如果傳入?yún)?shù) ,type 屬性將失效 ,僅支持 ['top','left','bottom','right','center']
this.$refs.popup.open('top')
}
}
}
</script>
報(bào)錯信息
文章來源:http://www.zghlxwxcb.cn/news/detail-744715.html
解決方法
this.$refs.popup[0].open()文章來源地址http://www.zghlxwxcb.cn/news/detail-744715.html
到了這里,關(guān)于小程序彈窗報(bào)錯this.$refs.popup.open is not a function的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!