//父组件
<template>
<view class="box">
aaa
</view>
<button @click="aaa">打开</button>
<popups :isShows="ishow"></popups>
</template>
<script setup lang="ts">
// import handleFun from "@/util/common/handleCallFun.js"
import { ref } from 'vue'
import popups from "@/components/abc.vue"
const ishow = ref(false)
const aaa = () => {
ishow.value = true
// console.log(ishow.value)
}
</script>
<style lang="scss" scoped>
</style>
//子组件
<template>
{{ isShows }}
<view class="pupup-login-box">
<uni-popup ref="isShows" type="bottom">底部弹出 Popup</uni-popup>
</view>
</template>
<script lang="ts" setup>
import { ref, watch } from 'vue'
interface Props {
isShows: Boolean
}
// const isShow: any = ref(false)
const { isShows } = defineProps<Props>()
console.log('aaaa',isShows)
// isShow.value = isShows
watch(
() => isShows,
(newVal, oldVal) => {
console.log("newVal==>", newVal);
console.log("oldVal==>", oldVal);
// if (isShow.value) {
// isShow.value.open();
// console.log(isShow.value)
// }
},
{
immediate: true,
deep: true,
}
);
// const emits = defineEmits(["getUserInfoData"])
// const handleLogin = async () => {
// emits("getUserInfoData"); //让父组件获取个人信息
// }
</script>
<style lang="scss" scoped>
</style>
1***@qq.com (作者)
感谢感谢
2022-11-10 17:09