index.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import ad from '../index/ad'
  2. const links = [
  3. {
  4. text: '首页',
  5. url: '/pages/index/index',
  6. openType: 'switchTab',
  7. },
  8. {
  9. text: '关于',
  10. url: '/pages/about/index',
  11. openType: 'switchTab',
  12. },
  13. ]
  14. const chips = [
  15. {
  16. text: '组件化',
  17. type: 'link',
  18. },
  19. {
  20. text: '可复用',
  21. type: 'link',
  22. },
  23. {
  24. text: '易扩展',
  25. type: 'link',
  26. },
  27. ]
  28. ad({
  29. data: {
  30. links,
  31. linksNoLinkData: links.map((v) => ({ text: v.text })),
  32. chips,
  33. chipsNoLinkData: chips.map((v) => ({ text: v.text })),
  34. },
  35. onLinkClick(e) {
  36. console.log('onLinkClick', e.detail)
  37. wx.showModal({
  38. title: `跳转到"${e.detail.item.text}"`,
  39. showCancel: !1,
  40. })
  41. },
  42. onChipClick(e) {
  43. console.log('onChipClick', e.detail)
  44. wx.showModal({
  45. title: `"${e.detail.item.text}"被点击了`,
  46. showCancel: !1,
  47. })
  48. },
  49. })