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)