Sun May 21 16:56:00 UTC 2023 inscode

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