页面代码:
<template>
<view class="container">
<popup-model :temp="temp.length" @handleClick="temp.length++;">
<view>我是slot</view>
</popup-model>
</view>
</template>
<script setup>
import {
computed,
ref
} from 'vue'
const temp = ref([])
</script>
popup-model组件代码:
<template>
<view>
<button class="button" type="primary" @click="showPopup">显示popup</button>
</view>
<!-- 普通弹窗 -->
<uni-popup ref="popup" type="bottom">
<view style=" background-color: white;border-radius: 20rpx 20rpx 0 0;margin-bottom: 102rpx;overflow: hidden;">
<button class="text" @click="emit('handleClick')">更新temp</button>
<slot></slot>
</view>
</uni-popup>
</template>
<script setup>
import {
ref
} from 'vue'
const emit = defineEmits(['handleClick'])
const popup = ref()
const showPopup = () => {
if (popup.value.showPopup) {
popup.value.close();
} else {
popup.value.open();
}
};
</script>
1 个回复
十五春会 (作者)
没人管uni-popup了吗.../_ \