在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ vue報(bào)重復(fù)使用slot怎么解決

vue報(bào)重復(fù)使用slot怎么解決

報(bào)的錯誤;

clipboard.png
代碼如下:

 <div class="row table-responsive scrollbar" ref="table" style="overflow: hidden" :style="containerStyle">
    <div>
    <el-collapse accordion>
      <el-collapse-item v-for="item in admintitle ">
        <template slot="title">
          {{item}}
        </template>
      <table class="table table-striped table-hover table-condensed scrollbar" :id="gridId" style="table-layout:fixed;margin-bottom: 0"
             :style="tableStyle">
        <thead>
        <tr :style="theadStyle">
          <th v-if="checked" class="col-md-1">
            <!--全選-->
            <el-checkbox v-model="getSelectStatue" @change="changeAll"></el-checkbox>
          </th>
          <th v-for="(key,index) in columnsArr" :class="[specialClass(index), sortActive ? 'headSort' : '' ]" :style="styleArr.length > 0 ? styleArr[index] : {}" @click="sort(key,index)" :key="index">
            <span style="vertical-align: middle">{{key.name}}</span>
            <span v-if="sortActive && !lastSort">
              <span class="table-sort" v-if="index != columns.length -1 && index != 0">
                <span :style="key.ascStyle"></span>
                <span :style="key.descStyle"></span>
              </span>
            </span>
            <span v-else-if="sortActive && lastSort">
              <span class="table-sort" v-if="index != 0">
                <span :style="key.ascStyle"></span>
                <span :style="key.descStyle"></span>
              </span>
            </span>
          </th>
        </tr>
        </thead>
        <tbody >
        <slot name="tbody">
        </slot>
        </tbody>
        <tfoot>
        <slot name="tfoot">
        </slot>
        </tfoot>
      </table>
      </el-collapse-item>
    </el-collapse>
    </div>
  </div>
回答
編輯回答
有點(diǎn)壞

你在v-for循環(huán)上加上key試試

2017年1月22日 06:20
編輯回答
笑忘初

需要把循環(huán)放在父組件里,就解決了

2017年7月14日 17:20