Extend the type of dataKey to support function by aisin · Pull Request #232 · tangbc/vue-virtual-scroll-list (original) (raw)

It is indeed simpler to use, but it is too strict on business data and cannot meet some business scenarios, such as data-sources like this:

[
  {
    "cider": {
      "uid": 2261688
    },
    "chatData": {
      ...
    }
  },

  ...

  {
    ...
  }
]

In each item, cider.uid should be used as uniqueId.
And another data-sources example:

[
  {
    "cider": {
      "coid": 8618240,
      "ccid": 7413760
    },
    "chatData": {
      ...
    }
  },

  ...

  {
    ...
  }
]

There is not a field in each item object that can be used as uniqueId, but rather I need to generate one based on the given coid and ccid fields. However, since the item component is passed into the library as a prop, a function needs to be passed to generate the uniqueId.