singleimg.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. var Nova = getApp().Nova;
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {
  7. options: null,
  8. },
  9. /**
  10. * 组件的初始数据
  11. */
  12. data: {
  13. },
  14. ready: function() { // 在组件布局完成后执行,确保options参数中有data信息
  15. this.loadData();
  16. },
  17. /**
  18. * 组件的方法列表
  19. */
  20. methods: {
  21. async loadData() {
  22. let { options } = this.data
  23. console.log('单图组', options);
  24. let {
  25. data,
  26. style,
  27. } = options
  28. console.log(style);
  29. let { className, src, filter, list } = data
  30. this.setData({
  31. list,
  32. src,
  33. style,
  34. className,
  35. filter
  36. })
  37. },
  38. goNovaURL: function(ev) {
  39. let item = ev.currentTarget.dataset.item;
  40. let url = ''
  41. if (item.className == 'ShopGoods' && item.objectId) {
  42. url = "/nova-shop/pages/shop-goods/goods-detail/index?id=" + item.objectId
  43. }
  44. if (item.className == 'Article' && item.objectId) {
  45. url = "/common-page/pages/cates/article-detail/index?id=" + item.objectId
  46. }
  47. if (item.className == 'Lesson' && item.objectId) {
  48. url = ""
  49. }
  50. if (item.url) {
  51. url = item.url
  52. }
  53. Nova.goNovaURL(url);
  54. }
  55. }
  56. })