You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
587 B
27 lines
587 B
<template> |
|
<!-- 2. 通过v-model:参数名的方式传递数据 --> |
|
<ChildComponentA v-model:name="p_name" v-model:title="p_title"></ChildComponentA> |
|
<br> |
|
<label>这是父组件内容:</label> |
|
<p>名称:{{ p_name }}</p> |
|
<p>标题:{{ p_title }}</p> |
|
</template> |
|
|
|
<script> |
|
import ChildComponentA from "@/components/ChildComponentA.vue"; |
|
|
|
export default { |
|
components: {ChildComponentA}, |
|
// 1. 定义用于互通的数据 |
|
data() { |
|
return { |
|
p_name: '父组件name数据', |
|
p_title: '父组件title数据', |
|
} |
|
} |
|
} |
|
</script> |
|
|
|
<style scoped> |
|
|
|
</style>
|
|
|