list-view-multiplex-video.uvue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <!-- #ifdef WEB -->
  3. <view>
  4. <!-- #endif -->
  5. <list-view class="list" @scrolltolower="onScrollTolower">
  6. <list-item class="list-item" v-for="(_,index) in item_count">
  7. <text>第{{index + 1}}个视频</text>
  8. <video class="video" :src="src" :controls="true" @pause="onPause"></video>
  9. </list-item>
  10. </list-view>
  11. <!-- #ifdef WEB -->
  12. </view>
  13. <!-- #endif -->
  14. </template>
  15. <script>
  16. export default {
  17. data() {
  18. return {
  19. item_count: 10,
  20. src: 'https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo.mp4',
  21. isTesting: false
  22. }
  23. },
  24. methods: {
  25. onPause(e : UniEvent) {
  26. console.log(JSON.stringify(e));
  27. },
  28. onScrollTolower(_ : ScrollToLowerEvent) {
  29. setTimeout(() => {
  30. if (this.isTesting && this.item_count >= 10) {
  31. return
  32. }
  33. this.item_count += 10
  34. }, 300)
  35. },
  36. }
  37. }
  38. </script>
  39. <style>
  40. .list {
  41. flex: 1;
  42. }
  43. .list-item {
  44. background-color: white;
  45. margin-bottom: 30px;
  46. }
  47. .video {
  48. width: 100%;
  49. height: 200px;
  50. }
  51. </style>