We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
可用 X-Template 來指定 HTML Template,一定要有 id,才能用 id 來找到該元件
<script type="text/x-template" id="myComponent"> <div> My component! </div> </script> <script> // register global component! Vue.component('my-component', { template: '#myComponent' }) </script>
component 的 data 必須要是 function return data object
因 JavaScript 切分變數有效範圍的最 單位為 function, 內的 data 屬性必須是 function 的形式 輸出。
key 的作用,有 key 會移除 DOM 更換新的 node,沒有則不會做這件事,除非數量不同
:is
<keep-alive></keep-alive>
<slot></slot>
js object clone 最快的方法是 JSON.stringfy 再轉回來,但前提是不能有 function
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Vue Component
可用 X-Template 來指定 HTML Template,一定要有 id,才能用 id 來找到該元件
Component 的 data
component 的 data 必須要是 function return data object
v-for 的 key
key 的作用,有 key 會移除 DOM 更換新的 node,沒有則不會做這件事,除非數量不同
Component 的 props
實體,需要被更新的 component 跟 event bus 註冊 $on 事件,需要送出更新的 component 對於 event bus 送出 $emit 事件。
Component 動態切換
:is
屬性來決定是否該產生此 component,出現與消失會經過 life cycle。<keep-alive></keep-alive>
來避免重新 mount,並在顯示隱藏時經過 activated 與 deactivated 這兩個 life cycle。Slot 可在子元件身上開洞,讓父元件決定內容
<slot></slot>
可由子元件決定預設顯示資料(預設時,slot 綁有變數會吃 chlid 的)Vue 檔案
The text was updated successfully, but these errors were encountered: