|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- const imgurl = require("../../utils/imgurl");
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- merchantVoList: {
- value: [],
- type: Array
- }
- },
-
- /**
- * 组件的初始数据
- */
- data: {
- teljpgUrl: imgurl.teljpg.url,
- showMore:true,
- more: "点击查看更多",
- hidden:"hidden",
- height: ""
- },
-
- /**
- * 组件的方法列表
- */
- methods: {
- /**
- * 跳转到门店列表的详情页面
- */
- gotoDetail(e) {
- wx.navigateTo({
- url: `/pages/index/searchbar/detail/index?id=${e.currentTarget.dataset.id}`
- })
- },
- // 点击查看更多
- more: function () {
- let that = this;
- if (that.data.more == '点击查看更多') {
- this.setData({
- hidden: "",
- height: 'auto!important',
- more: "点击收起",
- showMore: true
- })
- } else {
- that.setData({
- hidden: "hidden",
- height: 4 * 140 + 'rpx',
- more: "点击查看更多",
- showMore: true
- })
- }
- },
- phone: function (e) {
- let that = this;
- wx.makePhoneCall({
- phoneNumber: e.target.dataset.merchantlinkphone
- });
- }
- },
- ready: function () {
- let merchantVoList = this.properties.merchantVoList;
- if (merchantVoList.length>0){
- if (merchantVoList.length <= 4) {
- this.setData({
- height: merchantVoList.length * 140 + 'rpx',
- showMore: false,
- hidden:"hidden"
- })
- } else if (merchantVoList && merchantVoList.length > 4) {
- this.setData({
- height: 4 * 140 + 'rpx'
- })
- }
- }
- }
- });
|