index.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // components/diy-myfunction/index.js
  2. var Nova = getApp().Nova;
  3. Component({
  4. /**
  5. * 组件的属性列表
  6. */
  7. properties: {
  8. options: null,
  9. },
  10. /**
  11. * 组件的初始数据
  12. */
  13. data: {
  14. list: [],
  15. },
  16. /**
  17. * 组件的方法列表
  18. */
  19. ready: function() {
  20. // 在组件布局完成后执行,确保options参数中有data信息
  21. this.loadData();
  22. },
  23. methods: {
  24. async loadData() {
  25. await Nova.checkComponentsDataProperties(this);
  26. let list = await Nova.getBlockData(this.data.options.data);
  27. let { options } = this.data;
  28. console.log("我的功能组", options);
  29. console.log(list);
  30. let { data, src, style } = options;
  31. let { className, filter } = data;
  32. this.setData({
  33. list,
  34. style,
  35. className,
  36. filter,
  37. });
  38. },
  39. goNovaURL: function(ev) {
  40. console.log(ev);
  41. let url = ev.currentTarget.dataset.url;
  42. console.log(url);
  43. wx.navigateTo({
  44. url: url,
  45. });
  46. },
  47. },
  48. });