美文网首页
Vue el-table的一些小用法(行内链接,图标等,持续更新

Vue el-table的一些小用法(行内链接,图标等,持续更新

作者: 璃小灯吖 | 来源:发表于2020-04-13 19:16 被阅读0次

最近在使用el-table时经常用到的一些小的需求处理,这里做个记录以便查阅。(截图中用的数据是乱的不要在意)

1、行内文字前面加图标


直接利用slot插槽就可以添加图标了,我这里是直接用img标签引入,用svg应该也是一样的

<el-table-column label="课程文件名" prop="nodeCode" align="left" width="210px">
      <template slot-scope="scope">
          <img src="../../../views/images/文件夹.png">
          {{scope.row.nodeName}}
        </template>
      </el-table-column>

2、行内路由跳转

解释一下就是,某一行的某一列属性上需要一个点击它就能跳转到另一个页面(类似详情页面)的功能

<el-table-column label="课程文件名" prop="nodeCode" align="left" width="210px">
      <template slot-scope="scope">
          <router-link :to="{name:'CoursewareDetail',query:{}}">  
          {{scope.row.nodeName}}
          </router-link>
      </template>
</el-table-column>

3、行内链接跳转

这是在网上看到的先记录一下

<template slot-scope="scope">
          <a :href="'http://'+scope.row.Address"
            target="_blank"
            class="buttonText">{{scope.row.Address}}</a>
</template>

相关文章

网友评论

      本文标题:Vue el-table的一些小用法(行内链接,图标等,持续更新

      本文链接:https://www.haomeiwen.com/subject/xdinmhtx.html