<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                [TOC] >[success] # 組件概念初探,對 TodoList 進行組件代碼拆分 本章節講解了,如何使用 **v-bind指令** 以及 **創建組件**、 **使用組件** 的概念,案例如下: **index.html** ~~~ <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Todo List組件封裝</title> <!-- 通過cdn方式引入vue --> <script src="https://unpkg.com/vue@next"></script> </head> <body> <div id="root"></div> </body> <script> // 創建vue實例 const app = Vue.createApp({ data(){ return{ inputValue: '', list: [ 'hello', 'word', 'dell', 'lee' ] } }, methods: { handleAddItem(){ this.list.push(this.inputValue) this.inputValue = '' } }, template: ` <div> <input v-model="inputValue"/> <button v-on:click="handleAddItem" v-bind:title="inputValue">增加</button> <ul> <todo-item v-for="(item, index) of list" v-bind:content="item" v-bind:index="index"/> </ul> </div> ` // 在標簽中使用變量 }) // 定義組件同時注冊組件 app.component('todo-item', { // 參數1:組件名稱,參數2:組件配置 props: ['content', 'index'], // 接收父組件傳值 template: '<li>{{index}} -- {{content}}</li>' }) // 1. 將template中的內容掛載到id為root的元素中 //?2.?如果有組件,必須要先注冊組件,不可直接鏈式寫法創建實例(例如:Vue.createApp(...).mount('#root')), 然后直接掛載到頁面元素執行mount,載到頁面元素執行mount, // 那樣的話頁面已經初始化完成了,component就加不進去了,所以最后mount才可以 app.mount('#root') </script> </html> ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看