Table表格中使用el-image


1. 按需引入组件

import {Image} from 'element-ui'
Vue.use(Image)

2. 在 Table表格 中使用 el-image

<el-table-column
        prop="photo"
        label="头像">
    <template slot-scope="scope">
        <el-image
            style="width: 100px; height: 100px"
            :src="scope.row.photo.url"
            :fit="scope.row.photo.fit"
            :preview-src-list="scope.row.photo.preview">
        </el-image>
    </template>
</el-table-column>

注意其中点击显示大图的 preview 的数据结构应该是一个数组

data () {
    return {
        tableData: [
            {
                photo:{
                    url:''
                    fit: 'fill'
                    preview: ['https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg']
                }   
            }
        ]
    }
}

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM