| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 | <template>	<view class="medicine-box box">		<view class="title-box">			<view class="title">推荐药品</view>			<view class="more" @click="navTo('/pages_shopping/home/productList')">				<view class="text">更多药品</view>				<image src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/arrow_gray.png"></image>			</view>		</view>		<medicineItem v-for="(item, index) in list" :key="index" :item="item"></medicineItem>		<Loading :loaded="loaded" :loading="loading"></Loading>	</view></template><script>	import medicineItem from "@/components/medicineItem";	import {getTuiProducts} from '@/api/index.js'	import Loading from "@/components/Loading";	export default {		components: {			Loading,			medicineItem		},		name: "likeProduct",		data() {			return {				page: {					page: 1,					pageSize: 4				},				total: 0,				list: [],				loaded: false,				loading: false			};		},		created() {},		mounted() {			this.getTuiProducts();		},		methods: {			getTuiProducts() {				var that = this;				if (that.loaded == true || that.loading == true) return;				that.loading = true;				getTuiProducts(that.page).then(					res => {						if (res.code == 200) {							that.total = res.data.total;							that.list.push.apply(that.list, res.data.list);							that.loading = false;							that.loaded = that.list.length < that.total ? false : true;							that.page.page = that.page.page + 1;							uni.hideLoading()						}					},					err => {						uni.hideLoading()						uni.showToast({							title: err.msg,							icon: 'none',							duration: 2000						});					}				)			},			navTo(url){				uni.navigateTo({					url: url				})			},		}	};</script><style lang="scss" scoped>	.box {		background: #FFFFFF;		border-radius: 16rpx 16rpx 16rpx 16rpx;		margin: 24rpx;		box-sizing: border-box;		.title-box {			display: flex;			flex-direction: row;			align-items: center;			justify-content: space-between;			padding: 28rpx 0 8rpx 0;			box-sizing: border-box;			.title {				font-size: 32upx;				font-family: PingFang SC;				font-weight: bold;				color: #111111;			}			.more {				display: flex;				align-items: center;				justify-content: flex-end;				.text {					font-size: 24rpx;					font-family: PingFang SC;					color: #9B9B9B;				}				image {					margin-left: 10rpx;					width: 15rpx;					height: 20rpx;				}			}		}	}	.medicine-box {		padding: 0 24rpx 10rpx 24rpx;	}</style>
 |