修改定时刷新机制
parent
559cd0929e
commit
b1e67ad084
|
|
@ -33,6 +33,7 @@ const dataHandler = (event) => {
|
||||||
customeText.value = event
|
customeText.value = event
|
||||||
}
|
}
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
console.log(propValue)
|
||||||
try {
|
try {
|
||||||
const queryParems = { tag: propValue.base.tag }
|
const queryParems = { tag: propValue.base.tag }
|
||||||
const res = await http.get({ url: propValue.base.url, params: queryParems })
|
const res = await http.get({ url: propValue.base.url, params: queryParems })
|
||||||
|
|
@ -45,16 +46,19 @@ onMounted(async () => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const dataChange = (resp: any, _?: string) => {
|
const dataChange = (resp: any, _?: string) => {
|
||||||
|
console.log(resp)
|
||||||
if (!resp || !resp.data.data) {
|
if (!resp ||( !resp.afterData && !resp.data.data)) {
|
||||||
console.log("数据失败-----")
|
console.log("数据失败-----")
|
||||||
return
|
|
||||||
}
|
}
|
||||||
if (resp.status === 'SUCCESS') {
|
if(resp.afterData && resp.status === 'SUCCESS'){
|
||||||
console.log(resp.data.data)
|
console.log("数据-----afterData")
|
||||||
|
dataHandler(resp.afterData)
|
||||||
|
}else if(resp.data.data && resp.status === 'SUCCESS'){
|
||||||
|
console.log("数据-----data.data")
|
||||||
dataHandler(resp.data.data)
|
dataHandler(resp.data.data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
useData(props.component, dataChange)
|
useData(props.component, dataChange)
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@ class RestRequestData implements DataInstance {
|
||||||
public async connect(acceptor: DataAcceptor) {
|
public async connect(acceptor: DataAcceptor) {
|
||||||
const { otherConfig } = this.options || {}
|
const { otherConfig } = this.options || {}
|
||||||
if (otherConfig.isRepeat) {
|
if (otherConfig.isRepeat) {
|
||||||
|
const resp = await this.getRespData()
|
||||||
|
acceptor(resp)
|
||||||
const handler = async () => {
|
const handler = async () => {
|
||||||
const resp = await this.getRespData()
|
const resp = await this.getRespData()
|
||||||
acceptor(resp)
|
acceptor(resp)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue