父組件的編寫
<a:orgCode=orgCode ></a>
在data里面增加orgCode。
data() {
return {
orgCode: '037',
},
};
},
子組件編寫
子組件通過prop接收
props: {
orgCode: {
type: String,
default: null,
},
},
子組件使用
子組件可以通過this.orgCode進行使用。