Closed robertnicjoo closed 4 years ago
please follow sample to make a reproduce. I can not get your point. http://jsfiddle.net/zpczjl/9tp3z4bn/
But if you want to custom a column, you can follow https://www.njleonzhang.com/vue-data-tables/#/en-us/actionCol?id=customize-the-action-column
<el-table-column label="Actions" min-width="100px">
<template slot-scope="scope">
<el-button v-for="button in customButtonsForRow(scope.row)" :key="button.name" type="text" @click="button.handler">
{{ button.name }}
</el-button>
<el-checkbox :value="true">delete
</el-checkbox></template>
</el-table-column>
with slot-scope
you can make any customization for any column.
@njleonzhang here is what i want
I just want to show my products image in cover column. Currently i only get url and unable to use <img
tag.
@njleonzhang here is result based on your suggestion slot-scope
I think you should use :src="photo", anyway it's not an issue about vue-data-talbes
.
Well this was closed by no valid answer provided, so i add final code and try to actually help whoever comes here in future.
<el-table-column align="center" label="Cover">
<template slot-scope="scope" class="image-slot">
<el-image style="width: 90px; height: 90px" :src="scope.row.photo" lazy>
</el-image>
</template>
</el-table-column>
The error that i got in my screenshot above about scope
was because it requires to provide information of that scope slot
so i had to add scope.row.photo
in my :src
and :src
without scope.row
won't work at all.
Note: as we do not have loop v-for
in element ui let say:
v-for="product in products"
so it gives us row
instead of product
. Which is like:
row.photo
hope it can help others.
now you can close it
Please follow the issue template, or your issue may be closed automatically.
For bug report, provide the following section
Online reproduce
It is important to provide an online sample to reproduce the issue.
Expected Behavior
Showing image in
el-table-column
Current Behavior
Not sure how to show it when
el-table-column
is prop basedSteps to Reproduce
here is my code:
Detailed Description
I need to show my cover column (cover image of products) as images, but i cannot get full path in prop part.
For feature request, provide the following section
Motivation / Use Case
First of all: I'm not sure what this part is, just in case i share my second need in this table here but my priority is to show images (as i explained above)
Showing numbers with thousands commas columns of
price
andnew_price
Expected Behavior
Currently it shows numbers as plain as they are i can't get filter in prop values
Other Information
Nothing.