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.
34 lines
656 B
34 lines
656 B
1 year ago
|
<template>
|
||
|
<h1>{{parent_param}}</h1>
|
||
|
<h2>{{parent_param_full}}</h2>
|
||
|
<h3>这是子组件h3标签</h3>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
export default {
|
||
|
name: "ChildComponentA",
|
||
|
// 基本形式
|
||
|
// props: ['parent_param', ]
|
||
|
// 增加数据类型
|
||
|
props: {
|
||
|
parent_param: String,
|
||
|
parent_param_full: {
|
||
|
type: String,
|
||
|
default: "子组件的默认值",
|
||
|
// 对象或数组默认值必须从一个工厂函数获取
|
||
|
// default: function () {
|
||
|
// return { message: 'hello' }
|
||
|
// },
|
||
|
required: true,
|
||
|
validator: value => {
|
||
|
return value.length > 0
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style scoped>
|
||
|
|
||
|
</style>
|