zoukankan      html  css  js  c++  java
  • vue 插槽slot _fei

    具名插槽、作用域插槽、理解编译作用域

    01)插槽

    <div id="app">
        <children_fei></children_fei>
        <children_fei><span slot="center">父_中间</span></children_fei><!-- 具名插槽 -->
        <children_fei>
            <ul slot="name_c" slot-scope="slot_bar"> <!-- 作用域插槽 -->
                <span v-for="item in slot_bar.data_fei">{{item}}</span>
            </ul>
        </children_fei>
    </div>
    <template id="children_foo">
        <div>
            <slot name="left"><span>左边</span></slot>
            <slot name="center"><span>中间</span></slot>
            <slot name="right"><span>右边</span></slot>
            <slot name="name_c" :data_fei="c_books">
                <ul>
                    <li v-for="item in c_books">{{item}}</li>
                </ul>
            </slot>
        </div>
    </template>
    <script src="vue.js"></script>
    <script>
        const children_fei = {
            template: '#children_foo',
            data() {
                return {
                    children_message: "我是子组件bar",
                    c_books: ['论语', '史记', '左传', '汉书', '战国策']
                }
            }
        };
        const app = new Vue({
            el: '#app',
            data() {
                return {
                    message: 'Hello Vue!',
                }
            },
            components: {
                children_fei
            }
        });
    </script>

  • 相关阅读:
    LeetCode OJ Remove Duplicates from Sorted Array II
    LeetCode OJ 75. Sort Colors
    LeetCode OJ 74. Search a 2D Matrix
    LeetCode OJ 73. Set Matrix Zeroes
    Taglist
    NERDTree
    Beyond Compare 4
    Beyond compare vs kdiff3
    切換 java compiler 版本
    PE+ 1.0 ( Pump Express Plus 1.0 )
  • 原文地址:https://www.cnblogs.com/dafei4/p/12939046.html
Copyright © 2011-2022 走看看