wxml:

  <view class="page-section-spacing">
<view>
<text>商家列表</text>
</view>
<scroll-view scroll-y="true" class="page-scroll-style" bindscrolltolower="scroll">
<block wx:for="{{goods}}" wx:key="goods">
<view class="scroll-view-content">
<image src="{{item.title}}" class="scroll-view-image"></image>
<view class="scroll-view-text">
{{item.price}}
</view>
<view class="scroll-view-name">
{{item.type}}
</view>
</view>
</block>
</scroll-view>
</view>
</view>

wxss:

/**index.wxss**/
.weui-search-bar {
position: relative;
padding: 8px 10px;
display: -webkit-box;
display: -webkit-flex;
display: flex;
box-sizing: border-box;
background-color: #EFEFF4;
border-top: 1rpx solid #D7D6DC;
border-bottom: 1rpx solid #D7D6DC;
}
.weui-icon-search_in-box {
position: absolute;
left: 10px;
top: 7px;
}
.weui-search-bar__form {
position: relative;
-webkit-box-flex: 1;
-webkit-flex: auto;
flex: auto;
border-radius: 5px;
background: #FFFFFF;
border: 1rpx solid #E6E6EA;
}
.weui-search-bar__box {
position: relative;
padding-left: 30px;
padding-right: 30px;
width: 100%;
box-sizing: border-box;
z-index: 1;
}
.weui-search-bar__input {
height: 28px;
line-height: 28px;
font-size: 14px;
}
.weui-search-bar__cancel-btn {
margin-left: 10px;
line-height: 28px;
color: #09BB07;
white-space: nowrap;
}
.swp{
height: 500rpx;
}
.page-section-spacing{
margin-top: 60rpx;
} .page-scroll-style{
height: 1000rpx;
background: aliceblue;
}
.scroll-view-content{
height: 230rpx;
margin: auto 10rpx;
background: white;
border: 1px solid gray;
}
.scroll-view-image{
width: 200rpx;
height: 200rpx;
margin-top: 15rpx;
margin-left: 20rpx;
float: left;
}
.scroll-view-text{
width: 400rpx;
float: left;
font-weight: 800;
margin-top: 15rpx;
margin-left: 20rpx;
}
.scroll-view-name{
float: left;
font-size: 30rpx;
color: gray;
margin-top: 20rpx;
margin-left: 20rpx;
}
.scroll-view_H{
white-space: nowrap;
}
.scroll-view-item{
height: 300rpx;
}
.scroll-view-item_H{
display: inline-block;
width: 100%;
height: 300rpx;
}

wxjs:

// 获取应用实例
const app = getApp() Page({
data: {
goods:[
{
'title':'22',
'price':'22-徐汇校区',
'type':'2',
"info":"22222222222222"
}, ],
page:1,
last_page : ''
},
//加载
scroll(e){
let that = this;
let page = that.data.page+1;
that.setData({
page:page
})
let last_page = that.data.last_page
if(page > last_page){
wx.showToast({
title: '到底了',
})
return ;
}
wx.showLoading({
title: '加载中',
})
wx.request({
// 请求的网址
url: 'http://www.yan.com/api/xcx/goodIndex',
data:{'page':page},
header: {
'content-type': 'application/json' // 默认值
},
method:"POST",
success (res) {
let goods = res.data.data.data;
that.setData({
goods:that.data.goods.concat(goods)
})
wx.hideLoading()
}
})
},
// 页面自动加载
onLoad() {
var that = this;
wx.request({
url: 'http://www.yan.com/api/xcx/goodIndex',
header: {
'content-type': 'application/json' // 默认值
},
method:'POST',
success (res) {
let goods = res.data.data.data;
that.setData({
goods:goods,
last_page:res.data.data.last_page
})
}
})
},
})

laravel 路由

//商品展示
Route::post('xcx/goodIndex','xcx\LoginController@goodIndex');

控制器代码

//商品列表展示
public function goodIndex(Request $request)
{
// 接受页码
$page=$request->post('page');
$data=GoodRelease::orderBy('id','desc')->paginate($page);
if(!$data){
return ['code' => 500, 'meg' => 'no', 'data' =>''];
}
return ['code' => 200, 'meg' => '列表展示成功', 'data' => $data]; }

效果图:

最新文章

  1. php打印数组 --- 打印出漂亮格式的数组
  2. VC2010 MFC中实现printf调试功能,即MFC程序利用控制台输出调试信息。
  3. Spring day01笔记
  4. ML 04、模型评估与模型选择
  5. visualvm添加远程管理-centos
  6. Java 获取各时区时间,获取当前时间到格林威治时间1970年01月01日00时00分00秒的秒数
  7. IO-同步,异步,阻塞,非阻塞,阅读摘要
  8. Python文件IO
  9. OPTIMIZE TABLE
  10. Oracle字符集查看
  11. Java基础---IO(二)--File类、Properties类、打印流、序列流(合并流)
  12. Linux系统监控命令详解
  13. 【WEB】带边框的网页页面实现
  14. MAVEN项目中include引入静态文件时报错找不到文件
  15. P2P的原理和常见的实现方式
  16. SQL2008 一直error40 无法连接到localhost
  17. vue生命周期 钩子函数
  18. MySQL DBA 管理常用命令
  19. mysql索引的优化
  20. ML入门理论

热门文章

  1. webpack搭建react+ts+eslint项目
  2. 如何高效地写 Form
  3. js-小知识点
  4. linnux命令 - brctl和ifconfig
  5. errorC2471:cannot update program database vc90.pdb
  6. atc工具模拟网络
  7. IP分组和分片
  8. 矩阵LU分解
  9. 用 Python 简单生成 WAV 波形声音文件
  10. c++ struct enum union加typedef与不加typedef