vue props 一次傳多個(gè)值實(shí)例
數(shù)組:
<custom-element :whatever='[...array]'></custom-element>
對(duì)象:
<custom-element :whatever='{...obj}'></custom-element>
或者:
<custom-element v-bind='obj' </custom-element>
子組件:
<ul class='car_wrap'> <li > <span> <i aria-hidden='true'></i> </span> <p>{{propsText.seleTime}}</p> </li> <li class='car_start'> <span> <i aria-hidden='true'></i> </span> <p>{{propsText.carsStart}}</p> </li> <li class='car_end'> <span> <i aria-hidden='true'></i> </span> <p>{{propsText.carEnd}}</p> </li> <li class='remark'> <span> <i aria-hidden='true'></i> </span> <p>{{propsText.Remark}}</p> </li> </ul> <div class='confirmation_car'> props: { propsText:{ type: Object, default:{} } },
父組件:
<!-- 選擇內(nèi)容 --> <div class='select_content'> <app-footer-car :clock='clock' :propsText='{...propsText}'/> </div> import appFooterCar from '../FooterCarList/FooterCarList';data() { return { propsText:{ seleTime:11, carsStart:22, carEnd:33, Remark:44, confirmationCar:55 } };
補(bǔ)充知識(shí):vue props 屬性值接受多個(gè)類型
我就廢話不多說(shuō)了,大家還是直接看代碼吧~
originalData: { type: Array | Object, default () { return [] } } } ```
以上這篇vue props 一次傳多個(gè)值實(shí)例就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. 理解PHP5中static和const關(guān)鍵字2. Android table布局開發(fā)實(shí)現(xiàn)簡(jiǎn)單計(jì)算器3. python 代碼實(shí)現(xiàn)k-means聚類分析的思路(不使用現(xiàn)成聚類庫(kù))4. IntelliJ IDEA安裝插件的方法步驟5. Java如何基于反射機(jī)制獲取不同的類6. php模擬實(shí)現(xiàn)斗地主發(fā)牌7. Vue封裝一個(gè)TodoList的案例與瀏覽器本地緩存的應(yīng)用實(shí)現(xiàn)8. Android 在 res/layout 文件夾 下創(chuàng)建一個(gè) 子文件夾實(shí)例9. PHP安全-命令注入10. Vuex localStorage的具體使用

網(wǎng)公網(wǎng)安備