mirror of https://github.com/jeecgboot/jeecg-boot
JVxeTable表格Column配置formatter属性不生效 #6950]
parent
c75e9bf05b
commit
34442b7226
|
@ -1,13 +1,12 @@
|
||||||
<template>
|
<template>
|
||||||
<JVxeReloadEffect :vNode="innerValue" :effect="isEffect" @effectEnd="handleEffectEnd" />
|
<JVxeReloadEffect :vNode="innerLabel" :effect="isEffect" @effectEnd="handleEffectEnd" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { ref, defineComponent } from 'vue';
|
import { ref, watch, defineComponent } from 'vue';
|
||||||
import JVxeReloadEffect from '../JVxeReloadEffect';
|
import JVxeReloadEffect from '../JVxeReloadEffect';
|
||||||
import { JVxeComponent } from '/@/components/jeecg/JVxeTable/types';
|
import { JVxeComponent } from '/@/components/jeecg/JVxeTable/types';
|
||||||
import { useJVxeComponent, useJVxeCompProps } from '/@/components/jeecg/JVxeTable/hooks';
|
import { useJVxeComponent, useJVxeCompProps } from '/@/components/jeecg/JVxeTable/hooks';
|
||||||
import { watch } from 'vue';
|
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'JVxeNormalCell',
|
name: 'JVxeNormalCell',
|
||||||
|
@ -15,7 +14,7 @@
|
||||||
props: useJVxeCompProps(),
|
props: useJVxeCompProps(),
|
||||||
setup(props: JVxeComponent.Props) {
|
setup(props: JVxeComponent.Props) {
|
||||||
const setup = useJVxeComponent(props);
|
const setup = useJVxeComponent(props);
|
||||||
const { innerValue, row } = setup;
|
const { innerValue, innerLabel, row } = setup;
|
||||||
|
|
||||||
const reloadEffect = props.renderOptions.reloadEffect;
|
const reloadEffect = props.renderOptions.reloadEffect;
|
||||||
const isEffect = ref<boolean>(false);
|
const isEffect = ref<boolean>(false);
|
||||||
|
@ -39,6 +38,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
innerLabel,
|
||||||
innerValue,
|
innerValue,
|
||||||
isEffect,
|
isEffect,
|
||||||
handleEffectEnd,
|
handleEffectEnd,
|
||||||
|
|
|
@ -44,6 +44,17 @@ export function useJVxeComponent(props: JVxeComponent.Props) {
|
||||||
const fullDataLength = computed(() => props.params.$table.internalData.tableFullData.length);
|
const fullDataLength = computed(() => props.params.$table.internalData.tableFullData.length);
|
||||||
// 是否正在滚动中
|
// 是否正在滚动中
|
||||||
const scrolling = computed(() => !!props.renderOptions.scrolling);
|
const scrolling = computed(() => !!props.renderOptions.scrolling);
|
||||||
|
// 当有formatter时,优先使用formatter
|
||||||
|
const innerLabel = computed(() => {
|
||||||
|
if(typeof column.value?.formatter === 'function'){
|
||||||
|
return column.value.formatter({
|
||||||
|
cellValue: innerValue.value,
|
||||||
|
row: row.value,
|
||||||
|
column: column.value,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return innerValue.value
|
||||||
|
});
|
||||||
const cellProps = computed(() => {
|
const cellProps = computed(() => {
|
||||||
let renderOptions = props.renderOptions;
|
let renderOptions = props.renderOptions;
|
||||||
let col = originColumn.value;
|
let col = originColumn.value;
|
||||||
|
@ -111,6 +122,7 @@ export function useJVxeComponent(props: JVxeComponent.Props) {
|
||||||
return listeners;
|
return listeners;
|
||||||
});
|
});
|
||||||
const context = {
|
const context = {
|
||||||
|
innerLabel,
|
||||||
innerValue,
|
innerValue,
|
||||||
row,
|
row,
|
||||||
rows,
|
rows,
|
||||||
|
|
Loading…
Reference in New Issue