修改定时刷新机制
parent
559cd0929e
commit
b1e67ad084
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue