当前位置:   article > 正文

微信小程序美食推荐_微信小程序美食列表代码

微信小程序美食列表代码
  1. <!--index.wxml-->
  2. <wxs module="test">
  3. function deal(str){
  4. return str.substring(0,3)+'-'+str.substring(3,7)+'-'+str.substring(7,11)
  5. }
  6. module.exports={
  7. deal:deal
  8. }
  9. </wxs>
  10. <view class="warp" wx:for="{{list}}" wx:key="*this">
  11. <image class="image" src="{{item.image}}" mode=""/>
  12. <view class="right">
  13. <view class="title">{{item.title}}</view>
  14. <view>电话:{{test.deal(item.phone)}}</view>
  15. <view>地址:{{item.address}}</view>
  16. <view>营业时间:{{item.hours}}</view>
  17. </view>
  18. </view>
  19. // index.js
  20. Page({
  21. warp(){
  22. wx.stopPullDownRefresh()
  23. },
  24. onReachBottom(){
  25. console.log('触发了上拉事件');
  26. },
  27. onPullDownRefresh(){
  28. console.log('触发了下拉事件');
  29. },
  30. data:{
  31. list:[
  32. {
  33. image:"/image/回锅肉.jpg",
  34. title:'美味回锅肉',
  35. phone:'15321212323',
  36. address:'铜仁国际大酒店',
  37. hours:'周末早上9:00~晚上19:00',
  38. },
  39. {
  40. image:"/image/砂锅饭.jpg",
  41. title:'大碗砂锅饭',
  42. phone:'13895955959',
  43. address:'碧江区小十子',
  44. hours:'周末早上9:00~晚上19:00',
  45. },
  46. {
  47. image:"/image/洋葱炒蛋.jpg",
  48. title:'爆炒洋葱炒蛋',
  49. phone:'15454554544',
  50. address:'铜仁大十字',
  51. hours:'周末早上9:00~晚上19:00',
  52. },
  53. {
  54. image:"/image/土豆炒牛肉.jpg",
  55. title:'新鲜土豆炒牛肉',
  56. phone:'13878788787',
  57. address:'铜仁高铁站左转100米',
  58. hours:'周末早上9:00~晚上19:00',
  59. },
  60. ],
  61. }
  62. })
  63. {
  64. "usingComponents": { },
  65. "navigationBarTitleText": "贵州美食",
  66. "enablePullDownRefresh": true,
  67. "onReachBottomDistance": 100
  68. }
  69. .warp{
  70. display: flex;
  71. font-size: 27rpx;
  72. margin: 20rpx 5rpx;
  73. box-shadow: 0 0 10px;
  74. border-radius: 5px;
  75. padding: 15rpx;
  76. }
  77. .right{
  78. display: flex;
  79. justify-content: space-between;
  80. flex-direction: column;
  81. margin-left: 6rpx;
  82. }
  83. .image{
  84. height: 35vw;
  85. width: 35vw;
  86. flex-shrink: 0;
  87. }
  88. .title{
  89. font-weight: bold;
  90. font-size: 35rpx;
  91. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/643497
推荐阅读
相关标签
  

闽ICP备14008679号