微信小程序页面传值加跳转navigator传值跳转

js部分:

// pages/location/location.js
var app = getApp(); //应用程序
Page({
  /** 
   * 页面的初始数据
   */
  data: {
    dataList: [], //所店铺名及城市名集合
    // latitude:'',//纬度
    // longitude: '',//经度  
  },

  onLoad: function(options) {
    app.callback = (res) => {}//回调app.js里的登录函数,为了在运行单独页面时进行openID的调用
      wx.showLoading({
        title: '加载中...',
      })
      var that = this;
      wx.request({
        url: 'https://www.php',
        header: {
          ' ...........'
        },
        method: 'POST',
        data: {
          openid: app.userLogin.openid,
          type: 'empStoreList'
        },
        success: function(e) {
          console.log('店铺获取数据:', e.data)

          that.setData({
            dataList: e.data.str
          })
          wx.hideLoading();
          console.log('所店铺名及城市名dataList:', that.data.dataList)
          var arr = [];
          var arr1 = [];
          for (var i = 0; i < that.data.dataList.length; i++) {
            arr.push(that.data.dataList[i].store)
          }
          console.log("获取店铺:", arr)
          for (var y = 0; y < arr.length; y++) { //外层数组(1)
            // arr1.push(arr[y])
            for (var x = 0; x < arr[y].length; x++) { //内层数组(2)
              arr1.push(arr[y][x])
            }
          }
          that.setData({
            dataList: arr1
          })
          console.log("获取全部店铺:", arr1)

          
        }
      })
    
  },



})

wxml部分:

<!--pages/location/location.wxml-->
<view class="dp_location_main">
  <view class='list'>
    <block wx:for='{{dataList}}' wx:key='list' wx:for-item="item">
      <view class="list_item">
        <navigator url='../qianwang_location/qianwang_location?ID={{item.CODE}}&NAME={{item.NAME}}&CITY={{item.CITY}}&longitude={{item.longitude}}' hover-class="navigator-hover">
          <view class='img'>
            <image src="../image/1.png" mode="scaleToFill" />
          </view>
          <view class='info'>
            <view class='title'>{{item.NAME}}</view>
            <view class='price' >{{item.longitude==null?"未定位":"已定位"}}</view>
            <!-- <view class='price' wx:if='{{dingwei_tiaojian}}'>{{dianpu_dingwei}}</view> -->
            <view class='num'>所在城市:{{item.CITY}}</view>
          </view>
        </navigator>
        <view class='clear'></view>
      </view>
    </block>
  </view>
</view>

css部分:

/* pages/location/location.wxss */

.dp_location_main {
  margin: 0;
}

.clear {
  clear: both;
  overflow: hidden;
}

navigator {
  display: inline;
}

.list {
  margin-top: 10rpx;
}

.list .list_item {
  margin-top: 10rpx;
  padding: 10rpx;
  height: 123rpx;
  border: 2.5rpx solid #eeeef8;
}

.list .list_item .img {
  float: left;
  width: 20%;
  height: 100%;
}

.list .list_item .img image {
  width: 68%;
  height: 71%;
  position: relative;
  top: 14rpx;
}

.list .list_item .info {
  width: 60%;
  float: right;
  height: 100rpx;
  position: relative;
}

.list .list_item .info .title {
  color: #333;
  margin-left: -110rpx;
  font-size: 30rpx;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  /* border-bottom: 1rpx solid black; */
}

.list .list_item .info .price {
  color: #ff2727;
  margin-left: 332rpx;
  margin-top: 49rpx;
  font-size: 30rpx;
}

.list .list_item .info .num {
  position: absolute;
  left: 0rpx;
  bottom: 10rpx;
  color: #747474;
  margin-left: -110rpx;
  font-size: 30rpx;
  top: 65rpx;
}

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值