slot-scope的使用

用於插槽中生成列表:
    HomePanelLayout組件
    <section :class="['cardinfo-content', isHotFund ? 'hotfund-content':'']">
        <div :class='adjustColumnClass' v-for='index in column' :key='index'>
            <slot name='infoCardSlot' :data='data && data[index - 1]'></slot>
        </div>
    </section>
    <HomePanelLayout :config='helloconfig' class='home-hotFinancial' v-if='hotFinancialConfig.data.length' >
        slot-scope列表的每一項能拿到遍歷的數據,針對slot中的組件給他數據
        <div slot='infoCardSlot' slot-scope='hotFinancialInfo'>
            <HotFund :fundData='hotFinancialInfo.data'></HotFund>
        </div>
    </HomePanelLayout>

複製代碼
相關文章
相關標籤/搜索