-
Notifications
You must be signed in to change notification settings - Fork 605
Closed
Labels
Description
This is a great library! Really smart architecture.
With mixed lists & complex UIs, it's not always the easiest thing to just spell out the heights of the items individually (mixing in group headers, etc). Fortunately, your basic structure doesn't require that! What works better for me, is to set an explicit style on each item that announces the height (i.e. <h1 style="height: 30px">Some Header</h1>
), and then rewire the getVarSize thusly:
// return a variable size (height) from given index.
getVarSize: function (index, nocache) {
var cache = this.delta.varCache[index]
const get = (index) => {
var item = this.$slots.default[index];
if(item.data.staticStyle && item.data.staticStyle.height) {
var m = item.data.staticStyle.height.match(/^(.*)px$/);
return Number(m[1]);
}
return Number(item.data.attrs.height);
}
return (!nocache && cache && cache.size) || get(index) || 0
},
If I were to push this as a PR, I'd make it so it does this if variable
is set to true
, and retain the original behavior if it's a function. Thoughts?
tangbc