C端小程序
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. const imgurl = require("../../utils/imgurl");
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {
  7. merchantVoList: {
  8. value: [],
  9. type: Array
  10. }
  11. },
  12. /**
  13. * 组件的初始数据
  14. */
  15. data: {
  16. teljpgUrl: imgurl.teljpg.url,
  17. showMore:true,
  18. more: "点击查看更多",
  19. hidden:"hidden",
  20. height: ""
  21. },
  22. /**
  23. * 组件的方法列表
  24. */
  25. methods: {
  26. /**
  27. * 跳转到门店列表的详情页面
  28. */
  29. gotoDetail(e) {
  30. wx.navigateTo({
  31. url: `/pages/index/searchbar/detail/index?id=${e.currentTarget.dataset.id}`
  32. })
  33. },
  34. // 点击查看更多
  35. more: function () {
  36. let that = this;
  37. if (that.data.more == '点击查看更多') {
  38. this.setData({
  39. hidden: "",
  40. height: 'auto!important',
  41. more: "点击收起",
  42. showMore: true
  43. })
  44. } else {
  45. that.setData({
  46. hidden: "hidden",
  47. height: 4 * 140 + 'rpx',
  48. more: "点击查看更多",
  49. showMore: true
  50. })
  51. }
  52. },
  53. phone: function (e) {
  54. let that = this;
  55. wx.makePhoneCall({
  56. phoneNumber: e.target.dataset.merchantlinkphone
  57. });
  58. }
  59. },
  60. ready: function () {
  61. let merchantVoList = this.properties.merchantVoList;
  62. if (merchantVoList.length>0){
  63. if (merchantVoList.length <= 4) {
  64. this.setData({
  65. height: merchantVoList.length * 140 + 'rpx',
  66. showMore: false,
  67. hidden:"hidden"
  68. })
  69. } else if (merchantVoList && merchantVoList.length > 4) {
  70. this.setData({
  71. height: 4 * 140 + 'rpx'
  72. })
  73. }
  74. }
  75. }
  76. });