zoukankan      html  css  js  c++  java
  • <template slot-scope="scope"> 插槽 <div slot="reference"></div>

    个人理解插槽区别

     <template slot-scope="scope"> 在vue项目里面可以用,拿到的当面行后台返回的所有数据

    例如:

    <el-table-column fixed="right" label="操作" width="120">

       <template slot-scope="scope">

         <div> {{scope.row}} </div>  //可以拿到当前行,所有后台返回的数据

      </template>

    </el-table-column>

     <div slot="reference"></div>  前端用页面的一部分替换页面的另一部分

      例如:

     <td  width=35%>
                    <div v-if="item.ext=='png' || item.ext=='jpg'"> 
                              <el-popover
                                  placement="right"
                                  width="400"
                                  trigger="click">
                                  <img :src="item.url"/>  //替换项
                                   <div slot="reference">
                                      <img  :src="item.url" style="100px;height:50px; cursor:pointer" />   //被替换
                                   </div>                 
                            </el-popover>
                    </div>
                    <div v-else><a :href=item.url download="">{{item.fileName}}</a></div>
     </td>

     

  • 相关阅读:
    推荐一篇好文加上一些补充
    我也来写一个俄罗斯方块
    使用canvas绘制一个时钟
    断句:Store all parameters but the first passed to this function as an array
    Observer Pattern
    web worker 的 self
    练练断句
    as 什么意思?
    natively 在本地机器
    in mind (不是 切记 的意思)
  • 原文地址:https://www.cnblogs.com/maibao666/p/12971391.html
Copyright © 2011-2022 走看看