index.js 791 B

12345678910111213141516171819202122232425262728293031323334
  1. import baseComponent from '../helpers/baseComponent'
  2. import styleToCssString from '../helpers/libs/styleToCssString'
  3. baseComponent({
  4. relations: {
  5. '../virtual-list/index': {
  6. type: 'ancestor',
  7. },
  8. },
  9. properties: {
  10. prefixCls: {
  11. type: String,
  12. value: 'wux-virtual-item',
  13. },
  14. },
  15. data: {
  16. index: 0,
  17. wrapStyle: '',
  18. },
  19. methods: {
  20. updated(index, height) {
  21. this.setData({
  22. index,
  23. wrapStyle: styleToCssString({
  24. position: 'absolute',
  25. left: 0,
  26. top: index * height,
  27. width: '100%',
  28. height,
  29. }),
  30. })
  31. },
  32. },
  33. })