index.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import { $wuxGallery } from '../../dist/index'
  2. import ad from '../index/ad'
  3. ad({
  4. data: {
  5. urls: [
  6. 'http://cdn.skyvow.cn/logo.png',
  7. 'http://cdn.skyvow.cn/logo.png',
  8. 'http://cdn.skyvow.cn/logo.png',
  9. 'http://cdn.skyvow.cn/logo.png',
  10. ],
  11. },
  12. onLoad() {},
  13. showGallery(e) {
  14. const { current } = e.currentTarget.dataset
  15. const { urls } = this.data
  16. this.$wuxGallery = $wuxGallery()
  17. this.$wuxGallery.show({
  18. current,
  19. urls,
  20. ['delete']: (current, urls) => {
  21. urls.splice(current, 1)
  22. this.setData({
  23. urls,
  24. })
  25. return true
  26. },
  27. cancel() {
  28. console.log('Close gallery')
  29. },
  30. onTap(current, urls) {
  31. console.log(current, urls)
  32. return true
  33. },
  34. onChange(e) {
  35. console.log(e)
  36. },
  37. })
  38. },
  39. showGallery2(e) {
  40. const { current } = e.currentTarget.dataset
  41. const { urls } = this.data
  42. $wuxGallery().show({
  43. current,
  44. urls: urls.map((n) => ({ image: n, remark: n })),
  45. indicatorDots: true,
  46. indicatorColor: '#fff',
  47. indicatorActiveColor: '#04BE02',
  48. icon: 'http://cdn.skyvow.cn/logo.png',
  49. ['delete']: (current, urls) => {
  50. console.log('onIconClick')
  51. return true
  52. },
  53. })
  54. },
  55. previewImage(e) {
  56. const { current } = e.currentTarget.dataset
  57. const { urls } = this.data
  58. wx.previewImage({
  59. current,
  60. urls,
  61. })
  62. },
  63. })