vue 作用域插槽的使用
5.通過 slot.data 獲取到planguage的資料 (data是子元件插槽繫結的那個屬性)>
<
/cpn>
}<
/span>
<
/template>
<
/cpn>
"slot"
>
}<
/span>
<
/template>
<
/cpn>
<
/div>
"cpn"
>
}<
/span>
<
/template>
6.通過join進行分割處理 獲取的data資料
}<
/span>
vue 插槽作用域的使用
父元件想要在自個的模板中使用子元件的data資料,有3種方式 1.子元件傳送事件 主動方是子元件 2.父元件獲取子元件的物件,通過this.childredn或refs,但這種方式大多是用在scirpt 裡面,在template模板中並不適用 3.插槽作用域的方式獲取,該方式能在template模板...
Vue作用域插槽
root 父元件呼叫子元件的時候,給子元件傳了乙個插槽 這個插槽叫作用域插槽 作用域插槽必須以 template開頭和結尾 同時這個插槽要宣告 你要從子元件接收的資料都放在哪 這裡是放在props裡面了 還要告訴子元件模板的資訊 即接收的props怎麼展示資料 props tony h4 templ...
Vue作用域插槽
doctype html en utf 8 編譯作用域 title script head isshow cpn div cpn 我是子元件 h2 我是子元件的內容 p isshow 按鈕 button div template newvue components script body html ...