From b1e67ad084fd8120f3e452db8228135f45cb546c Mon Sep 17 00:00:00 2001 From: LX <768863620@qq.com> Date: Tue, 12 Dec 2023 13:18:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=9A=E6=97=B6=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/Text/SubText/SubText.vue | 14 +++++++++----- src/data/rest/handler.ts | 2 ++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/resource/Text/SubText/SubText.vue b/resource/Text/SubText/SubText.vue index e08f512..962ef47 100644 --- a/resource/Text/SubText/SubText.vue +++ b/resource/Text/SubText/SubText.vue @@ -33,6 +33,7 @@ const dataHandler = (event) => { customeText.value = event } onMounted(async () => { + console.log(propValue) try { const queryParems = { tag: propValue.base.tag } const res = await http.get({ url: propValue.base.url, params: queryParems }) @@ -45,16 +46,19 @@ onMounted(async () => { } }) const dataChange = (resp: any, _?: string) => { - - if (!resp || !resp.data.data) { + console.log(resp) + if (!resp ||( !resp.afterData && !resp.data.data)) { console.log("数据失败-----") - return } - if (resp.status === 'SUCCESS') { - console.log(resp.data.data) + if(resp.afterData && resp.status === 'SUCCESS'){ + console.log("数据-----afterData") + dataHandler(resp.afterData) + }else if(resp.data.data && resp.status === 'SUCCESS'){ + console.log("数据-----data.data") dataHandler(resp.data.data) } + } useData(props.component, dataChange) diff --git a/src/data/rest/handler.ts b/src/data/rest/handler.ts index dbcb1d2..db61b4b 100644 --- a/src/data/rest/handler.ts +++ b/src/data/rest/handler.ts @@ -21,6 +21,8 @@ class RestRequestData implements DataInstance { public async connect(acceptor: DataAcceptor) { const { otherConfig } = this.options || {} if (otherConfig.isRepeat) { + const resp = await this.getRespData() + acceptor(resp) const handler = async () => { const resp = await this.getRespData() acceptor(resp)