【优化】scrollview SetData接口默认回到顶部
parent
1b77aec298
commit
cf0e819d73
|
|
@ -297,7 +297,7 @@ function ScrollCycleView:OnOpen(itemGO, scrollBar, scrollSizeDeltaV2, dragType,
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function this:SetData(dataList, updateFunc, isTop, noAnim)
|
function this:SetData(dataList, updateFunc, noTop, noAnim)
|
||||||
self.dataList = dataList --传入的数据列表
|
self.dataList = dataList --传入的数据列表
|
||||||
self.updateFunc = updateFunc --刷新回调,返回数据列表的索引和对应预设
|
self.updateFunc = updateFunc --刷新回调,返回数据列表的索引和对应预设
|
||||||
self.dataCount = #dataList
|
self.dataCount = #dataList
|
||||||
|
|
@ -319,11 +319,11 @@ function this:SetData(dataList, updateFunc, isTop, noAnim)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 判断是否回到顶部,否则保持不动
|
-- 判断是否回到顶部,否则保持不动
|
||||||
if isTop then
|
if noTop then
|
||||||
self:SetShow(1)
|
|
||||||
else
|
|
||||||
local showIndex = self:CalShowIndex()
|
local showIndex = self:CalShowIndex()
|
||||||
self:SetShow(showIndex)
|
self:SetShow(showIndex)
|
||||||
|
else
|
||||||
|
self:SetShow(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue