<template> <view class="box"> <view class="view" v-for="(item,index) in workList" :key='index'> <text>维修人员:{{item.name}}</text> <text>职位:维修技术人员</text> <text>联系方式:{{item.phone}}</text> </view> <view class="noData" v-if="workList.length==0"> <image src="http://resource.weilaibike.com/none.png"></image> <view>暂无相关数据~</view> </view> </view> </template> <script> var app = getApp() export default{ data(){ return{ workList: '', } }, onLoad() { this.getWorker(); }, methods:{ getWorker:function(){ uni.showToast({ title:"加载中", icon:'none' }) app.request('personal/workerList', '', 'POST').then(res => { uni.hideLoading(); console.log(res,'这是列表数据打印') if(res.data){ this.workList=res.data }else{ this.workList='' } }) } } } </script> <style> @import url("/static/css/base.css"); page { width: 100%; height: 100%; background: #eee; } .box { width: 100%; display: flex; flex-direction: column; align-items: center; padding-top: 10rpx; } .box .view { width: 90%; background: white; display: flex; flex-direction: column; height: 200rpx; justify-content: space-around; margin-top: 20rpx; padding-left: 33rpx; font-size: 28rpx; font-family: PingFang SC; font-weight: 500; color: rgba(77, 77, 77, 1); border-radius: 10rpx; } </style>