From fda8e1e99951b99904756997c4ef52e7693745b0 Mon Sep 17 00:00:00 2001 From: Kubbo <390378816@qq.com> Date: Sat, 29 Jun 2024 13:30:06 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=9B=E9=80=BC=E5=B7=B2=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/inject.js | 19 +++++++++++++++++++ src/views/AppKeyGoods.vue | 40 ++++++++++++++++++--------------------- 2 files changed, 37 insertions(+), 22 deletions(-) diff --git a/src/utils/inject.js b/src/utils/inject.js index a5b24b7..23b4c24 100644 --- a/src/utils/inject.js +++ b/src/utils/inject.js @@ -36,6 +36,25 @@ Vue.prototype.$multipleStoreBoard = Vue.observable({ Vue.prototype.$storeBoard = Vue.observable({ search: {} }) +Vue.component("tableColumn", { + props: { + column: {default: () => ({})} + }, + render(h) { + const config = this.$props.column + return h('el-table-column', {props: config}, + config.children?.map(col => h("tableColumn", {props: {column: col}})) || h('template', { + slotScope: { + default: ({row}) => { + config.custom ? h('div', {style: {color: row.preSaleNum > row.stockNum ? 'red' : '#fff'}}, '周边库存情况') : + h('span', row[config.prop] || '') + } + } + })) + }, +}) + + export default Promise.all([ import("./fetch"), ...libs.map(url => new Promise(resolve => { diff --git a/src/views/AppKeyGoods.vue b/src/views/AppKeyGoods.vue index 361d2e2..79d9088 100644 --- a/src/views/AppKeyGoods.vue +++ b/src/views/AppKeyGoods.vue @@ -1,29 +1,11 @@