<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>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                >[success] # slot -- 插槽 ~~~ 1.插槽作用 就是由于插件又可以能外部人員需要添加一些自定的代碼,但由于組件標簽之中 是無法插入內容的因此有了插槽,簡單的說就是提供預留項 2. 解釋一下什么叫組件中間插入不進標簽: '<com><div>在com組件中我是不可以直接插入的</div> </com>' ~~~ >[danger] ##### 插槽案例 ~~~ 1.插槽有兩種一種是用name命名,然后添加的插槽進入指定的預留位置 2.另一種是<slot>沒有name,那么不管添加的什么標簽都會進入這個slot中 ~~~ ~~~ <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>Examples</title> <meta name="description" content=""> <meta name="keywords" content=""> <link href="" rel="stylesheet"> <script src="https://cdn.jsdelivr.net/npm/vue@2.5.22/dist/vue.js"></script> </head> <body> <div id="app"> <com> <!--如果不是用插槽組件中間寫的東西是不會顯示的--> <h1 slot ="first"> 我對應first插槽</h1> <h1 slot ="second"> 我對應second插槽</h1> <h1 slot ="third"> 我對應third插槽</h1> <h1 > 我對應沒有name 的插槽</h1> <!--<h1> 我是默認插槽</h1>--> </com> </div> <template id="com"> <div> {{msg}} <!--<slot></slot>--> <slot name="first"></slot> <slot name="second"></slot> <slot name="third"></slot> <slot name="default"></slot> </div> </template> <script type="text/javascript"> let com = { template:'#com', data(){ return{ msg:"插槽" } } }; var vm = new Vue({ el: "#app", data: { }, components: { com, } }) </script> </body> </html> ~~~ >[success] # 作用域插槽 -- slot-scope ~~~ 1.回想一下我們使用elementUi的table的時候row就能拿到當前table中的一整 行信息,這是因為使用了slot-scope 2 ~~~ >[danger] ## 案例 ~~~ <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>Examples</title> <meta name="description" content=""> <meta name="keywords" content=""> <link href="" rel="stylesheet"> <script src="https://cdn.jsdelivr.net/npm/vue@2.5.22/dist/vue.js"></script> </head> <body> <div id="app"> <!--接受父組件傳來的todos數據--> <com :todos="todos"> <!--定義一個獲取循環行信息的使用參數slotProps--> <template slot-scope="slotProps"> <!--定義一個獲取循環行信息的使用參數todos是我們在子組件定義的插槽返回信息的數據--> <span v-if="slotProps.todos.isComplete">?</span> <span>{{slotProps.todos.text}}</span> </template> </com> </div> <template id="com"> <div> <ul> <li v-for="todo in todos" :key="todo.id"> <slot :todos="todo"> </slot> </li> </ul> </div> </template> <script type="text/javascript"> let com = { template:'#com', props:['todos'], data(){ return{ msg:"插槽" } } }; var vm = new Vue({ el: "#app", data: { todos: [ { id: 0, text: 'ziwei0', isComplete: false }, { text: 'ziwei1', id: 1, isComplete: true }, { text: 'ziwei2', id: 2, isComplete: false }, { text: 'ziwei3', id: 3, isComplete: false } ] }, components: { com, } }) </script> </body> </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>

                              哎呀哎呀视频在线观看