Merge branch 'feature/feature-20250430-h5' of https://e.coding.yili.com/yldc/ylst/ylst-survey-h5 into feature/feature-20250430-h5
This commit is contained in:
@@ -106,6 +106,26 @@ function tooptipFormatter(data: { row: any; column: any; cellValue: any }): VNod
|
||||
content: data
|
||||
});
|
||||
}
|
||||
|
||||
// render
|
||||
const RenderSlot = {
|
||||
functional: true,
|
||||
props: {
|
||||
row: Object,
|
||||
render: Function,
|
||||
index: Number,
|
||||
column: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
setup(props) {
|
||||
return () => {
|
||||
const { row, index, column } = props;
|
||||
return props.render(h, { row, index, column });
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -136,10 +156,19 @@ function tooptipFormatter(data: { row: any; column: any; cellValue: any }): VNod
|
||||
<template #default="scope">
|
||||
<slot name="column-default" :scope="scope">
|
||||
<div
|
||||
v-if="!item.render"
|
||||
class="table-view-html"
|
||||
@click.stop="handleImageClick"
|
||||
v-html="scope.row[item.prop]"
|
||||
></div>
|
||||
|
||||
<RenderSlot
|
||||
v-else
|
||||
:row="scope.row"
|
||||
:render="item.render"
|
||||
:index="scope.$index"
|
||||
:column="item"
|
||||
></RenderSlot>
|
||||
</slot>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@@ -33,8 +33,6 @@ function useSetPieChart(
|
||||
|
||||
// 如果 data 变动,重新生成图表w
|
||||
watch(series, (value) => {
|
||||
console.log(chartInstance);
|
||||
|
||||
const currentOptions = chartInstance.getOption();
|
||||
|
||||
// 合并新的 series 数据到现有配置中
|
||||
|
||||
@@ -6,7 +6,6 @@ import CommonLayout from '@/components/Layout/CommonLayout.vue';
|
||||
|
||||
// 外部获取的数据
|
||||
const { data } = recommend({});
|
||||
|
||||
const props = ref<TablePropsType[]>([
|
||||
{
|
||||
prop: 'rank',
|
||||
@@ -26,7 +25,18 @@ const props = ref<TablePropsType[]>([
|
||||
{
|
||||
prop: 'sales_growth_ring_ratio',
|
||||
label: '销量增长环比',
|
||||
width: 120
|
||||
width: 120,
|
||||
render: (h, p) => {
|
||||
return h(
|
||||
'div',
|
||||
{
|
||||
style: {
|
||||
color: p.row.sales_growth_ring_ratio < 0 ? 'red' : 'green'
|
||||
}
|
||||
},
|
||||
p.row.sales_growth_ring_ratio
|
||||
);
|
||||
}
|
||||
}
|
||||
]);
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user