您现在的位置是:首页 >技术交流 >小程序使用vue3的ref调不起弹窗【 uni-popup,uv-popup 弹出层】网站首页技术交流
小程序使用vue3的ref调不起弹窗【 uni-popup,uv-popup 弹出层】
简介小程序使用vue3的ref调不起弹窗【 uni-popup,uv-popup 弹出层】
引用的组件未引入报错
Component is not found in path “uni_modules/uv-popup/components/uv-popup/uv-popup” (using by “subPage/store/detail”), may be missing corresponding “componentPlaceholder” option?
但这里并非单单是引入问题引起的,有可能是小程序打包,不会实时刷新导致的引入失败,这时候需要重启项目一下。
排除了基本的引入问题,那就按照下面基本案例,用uv-popup作为示范
<template>
<view class="user">健康管理师列表
<button @click="openPopup()">123</button>
<uv-popup ref="popup" mode="center">
<view>
成功出现
</view>
</uv-popup>
</view>
</template>
<script setup lang="ts">
import { ref } from "vue";
// 定义 ref 引用 popup 组件
const popup = ref()
const openPopup= async () => {
popup.value.open()
}
</script>
<style lang="scss" scoped>
</style>
风语者!平时喜欢研究各种技术,目前在从事后端开发工作,热爱生活、热爱工作。