选项式api写法
<template>
<view>
<image src="../../static/logo.png"></image>
<yq-update-x ref="yqUpdatex"></yq-update-x>
</view>
</template>
<script lang="uts">
export default {
data() {
return {
yqUpdatex: null as YqUpdateXComponentPublicInstance | null,
}
},
// 这里是onShow方法 不知道为啥,有时候插件市场就显示不出来
onShow() {
// 通过组件 ref 属性获取组件实例, 组件标签名首字母大写,驼峰+ComponentPublicInstance
this.yqUpdatex = this.$refs['yqUpdatex'] as YqUpdateXComponentPublicInstance
this.yqUpdatex!.show()
},
methods: {
}
}
</script>
组合式api写法
<template>
<view>
<image src="../../static/logo.png"></image>
<yq-update-x ref="yqUpdatex"></yq-update-x>
</view>
</template>
<script setup lang="uts">
import{ ref } from 'vue'
// 这里引入的onShow在插件市场老是显示不出来,自己写的时候加上
import { onShow } from '@dcloudio/uni-app'
const yqUpdatex = ref< YqUpdateXComponentPublicInstance | null>(null)
// 这里的onShow方法在插件市场老是显示不出来,自己写的时候加上
onShow(()=>{
yqUpdatex.value!.show()
})
</script>
赵永强 (作者)
https://ext.dcloud.net.cn/plugin?id=18131
2024-05-15 08:32
赵永强 (作者)
是不是bug
2024-05-15 17:15
DCloud_云服务_moyang
回复 赵永强: 是有问题,已经可以了
2024-05-15 19:30
赵永强 (作者)
回复 DCloud_云服务_moyang: 新加了一个插件,方法名又不见了https://ext.dcloud.net.cn/plugin?id=18856
2024-06-18 16:54