Sun May 21 16:56:00 UTC 2023 inscode

上级 e1927981
<script setup>
import erzi from './erzi.vue';
let baVal = "我是来自父组件的值";
</script>
<template>
<erzi :title="baVal"></erzi>
<erzi :title="你好"></erzi>
</template>
<style scoped>
......
<script setup>
import { defineProps, onMounted } from 'vue';
const props = defineProps({
title: String,
title: {
type: String,
default: '默认值'
}
});
onMounted(() => {
console.log(props.title);
})
</script>
<template>
<div>
获取来自父组件的值:{{ title }}
</div>
</template>
<style scoped>
</style>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册