data="{{...item}}"三個點的意思


es6運算符 三個點(…)

對象中的擴展運算符(...)用於取出參數對象中的所有可遍歷屬性,拷貝到當前對象之中

let bar = { a: 1, b: 2 };
let baz = { ...bar }; // { a: 1, b: 2 }

注意:復制對象(包括全部內容)還不是單純引用變量(baz=bar)!

<template name="msgItem">
  <view>
    <text> {{index}}: {{msg}} </text>
    <text> Time: {{time}} </text>
  </view>
</template>


<template is="msgItem" data="{{...item}}"/>

<!-- 輸出
0: this is a template Time: 2016-06-18
-->

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM