<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之旅 廣告
                [TOC] ## `vue-router`路由傳參 [文檔](https://router.vuejs.org/zh/guide/essentials/passing-props.html) ### 布爾模式 > 如果`props`被設置為`true`,`route.params`將會被設置為組件屬性。 ### 對象模式 ``` const router = new VueRouter({ routes:[ { path: '/bar/:name', name:'bar', component: Bar, props:{ a:1,b:2}} ] }) ``` ### 函數模式 ``` const router = new VueRouter({ routes:[ { path: '/bar/:name', name:'bar', component: Bar, props: (route) => ({ query: route.query.q, name:route.params.name }) } ] }) ``` ## 子組件中修改props傳進來的數據 > 需求:模態框組件中,點擊遮罩,關閉模態框 ### `v-model` [文檔](https://cn.vuejs.org/v2/guide/components-custom-events.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E7%BB%84%E4%BB%B6%E7%9A%84-v-model) **父組件** ``` <template> <div> <button @click="is_show_modal = true">模態框</button> <modal v-model="is_show_modal"></modal> </div> </template> <script> import modal from '../components/modal.vue' export default { data() { return { is_show_modal:false } }, components:{ modal }, methods:{} }; </script> ``` **子組件`modal.vue`** ``` <template> <div v-if="is_show_modal"> <div class="shade" @click="$emit('hide_modal', false)"></div> <div class="modal">模態框</div> </div> </template> <script> export default { props:['is_show_modal'], data(){ return {} }, model: { prop: 'is_show_modal', event: 'hide_modal' }, methods:{} } </script> ``` ### `.sync` [文檔](https://cn.vuejs.org/v2/guide/components-custom-events.html#sync-%E4%BF%AE%E9%A5%B0%E7%AC%A6) 父組件 ``` <template> <div> <button @click="is_show_modal = true">模態框</button> <modal v-bind:is_show_modal.sync="is_show_modal"></modal> </div> </template> <script> import modal from '../components/modal.vue' export default { data() { return { is_show_modal:false } }, components:{ modal }, methods:{} }; </script> ``` **子組件`modal.vue`** ``` <template> <div v-if="is_show_modal"> <div class="shade" @click="$emit('update:is_show_modal', false)"></div> <div class="modal">模態框</div> </div> </template> <script> export default { props:['is_show_modal'], data(){ return {} }, methods:{} } </script> ```
                  <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>

                              哎呀哎呀视频在线观看