list.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. "use strict";
  2. const app = getApp()
  3. Component({
  4. properties: {
  5. list: {
  6. type: Array,
  7. value: []
  8. }
  9. },
  10. observers: {
  11. "list": function (cur) {
  12. let videoList = (cur|| []).reverse()
  13. videoList = videoList.map(v=>{
  14. v.videoImg = v.clips[0].snaps[0]
  15. return v
  16. })
  17. this.setData({
  18. videoList
  19. })
  20. }
  21. },
  22. data: {
  23. slideButtons: [
  24. {
  25. type: 'warn',
  26. text: '删除',
  27. data: {
  28. }
  29. }
  30. ],
  31. videoList: [
  32. {}
  33. ]
  34. },
  35. ready() {
  36. },
  37. methods: {
  38. slideButtonTap: function (e) {
  39. wx.navigateTo({
  40. url: "/pages/video/video?select=" + e.currentTarget.dataset.index
  41. });
  42. },
  43. slideBtn(e) {
  44. app.globalData.generate.splice(e.currentTarget.dataset.index, 1);
  45. wx.setStorageSync('generated', JSON.stringify(app.globalData.generate))
  46. this.setData({
  47. videoList: app.globalData.generate
  48. })
  49. }
  50. }
  51. });