content.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // components/diy-content/content.js
  2. var Nova = getApp().Nova;
  3. Component({
  4. /**
  5. * 组件的属性列表
  6. */
  7. properties: {
  8. options: null
  9. },
  10. /**
  11. * 组件的初始数据
  12. */
  13. data: {},
  14. ready: function () { // 在组件布局完成后执行,确保options参数中有data信息
  15. this.loadData();
  16. },
  17. /**
  18. * 组件的方法列表
  19. */
  20. methods: {
  21. async loadData() {
  22. await Nova.checkComponentsDataProperties(this);
  23. console.log('文章资讯', this.data.options.data)
  24. let list = await Nova.getBlockData(this.data.options.data)
  25. let {
  26. options
  27. } = this.data
  28. console.log('文章组', options);
  29. console.log(list)
  30. let {
  31. column,
  32. data,
  33. style,
  34. } = options
  35. let {
  36. className,
  37. filter
  38. } = data
  39. this.setData({
  40. column: 'template5',
  41. list,
  42. data,
  43. style,
  44. className,
  45. filter
  46. })
  47. },
  48. goNovaURL: function (ev) {
  49. let {
  50. url,
  51. id,
  52. pageview
  53. } = ev.currentTarget.dataset
  54. console.log(id, pageview);
  55. if (id) {
  56. url = `/common-page/pages/cates/article-detail/index?aid=${id}`
  57. wx.navigateTo({
  58. url: url,
  59. });
  60. }
  61. }
  62. }
  63. })