docs
docs copied to clipboard
怎么定时刷新界面
怎么定时刷新界面
还有就是 滑动到界面最下面就能触发事件,有这个函数吗?
会增加布局管理器吗?
还有就是 滑动到界面最下面就能触发事件,有这个函数吗?
滑动到底部的时候会自动触发 fetch 并且带上你上一次返回的page参数
怎么定时刷新界面
使用 JavaScript 的 setInterval()
设置定时器:
setInterval(() => {
this.refresh();
}, 500)
module.exports = { type: 'list', async fetch({ args, page }) { let signature = spider.myMd5() let data = await $http.post(baseUrl+"/system?action=GetNetWork",signature) data = data.data console.log(data) items = []
items.push(
{
title:data.title,
style:'chips',
actions:[
{ title:data.system},
{ title:data.time}
]
}
)
setInterval(() => { this.refresh(); }, 2000) return items }
}
比如这段代码 ,setInterval应该放在哪个位置啊 放在上面这个位置,一开始是2秒,过一段时间就疯狂刷新了
module.exports = { type: 'list', async fetch({ args, page }) { let signature = spider.myMd5() let data = await $http.post(baseUrl+"/system?action=GetNetWork",signature) data = data.data console.log(data) items = []
items.push( { title:data.title, style:'chips', actions:[ { title:data.system}, { title:data.time} ] } )
setInterval(() => { this.refresh(); }, 2000) return items }
}
比如这段代码 ,setInterval应该放在哪个位置啊 放在上面这个位置,一开始是2秒,过一段时间就疯狂刷新了
放在created() 里好像可以了
可以放到 created() 的生命周期方法里 https://docs.dorajs.com/#/component/lifecycle
因为 fetch() 会执行多次,所以肯定不能放这里面的
On Fri, Oct 29, 2021 at 3:32 PM wjf1547 @.***> wrote:
module.exports = { type: 'list', async fetch({ args, page }) { let signature = spider.myMd5() let data = await $http.post(baseUrl+"/system?action=GetNetWork",signature) data = data.data console.log(data) items = []
items.push(
{
title:data.title, style:'chips', actions:[ { title:data.system}, { title:data.time} ]
}
)
setInterval(() => { this.refresh(); }, 2000) return items }
}
比如这段代码 ,setInterval应该放在哪个位置啊 放在上面这个位置,一开始是2秒,过一段时间就疯狂刷新了
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Dorajs/docs/issues/13#issuecomment-954498706, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYLKTX2NAUDPZ2I5CXHDF3UJJE2RANCNFSM5G6K3SGA .
滑动到底部的时候会自动触发 fetch 并且带上你上一次返回的page参数,
这句话没理解,我想传的参数再args里,page参数包含什么,有啥作用啊,有相关代码吗?
可以看下文档这里:https://docs.dorajs.com/#/component/list?id=list-%e7%bb%84%e4%bb%b6
On Fri, Oct 29, 2021 at 3:41 PM wjf1547 @.***> wrote:
滑动到底部的时候会自动触发 fetch 并且带上你上一次返回的page参数,
这句话没理解,page参数包含什么,有啥作用啊,有相关代码吗?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Dorajs/docs/issues/13#issuecomment-954503476, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYLKTWLSMMLPMW574S52M3UJJFZZANCNFSM5G6K3SGA .
可以看下文档这里:https://docs.dorajs.com/#/component/list?id=list-%e7%bb%84%e4%bb%b6 … On Fri, Oct 29, 2021 at 3:41 PM wjf1547 @.***> wrote: 滑动到底部的时候会自动触发 fetch 并且带上你上一次返回的page参数, 这句话没理解,page参数包含什么,有啥作用啊,有相关代码吗? — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#13 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYLKTWLSMMLPMW574S52M3UJJFZZANCNFSM5G6K3SGA . 好的