You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<template><view class="health-tips" :style="'margin-bottom: ' + meta.margin_bottom + 'px'"> <view class="title" v-if="title && show"> <span>{{title}}</span> </view> <view class="ul-content"> <view class="li-item" v-if="tipsData"> <view class="top-box"> <view class="topic"> {{tipsData.name}} </view> <view class="change" @tap="_changeItem"> 换一换 </view> </view> <view class="center-box"> {{tipsData.meta.subtitle}} </view> <view class="bottom-box"> <view class="item" :data-id="item.associate.id" v-for="(item, index) in tipsData.children" :key="index" @tap="_jumpToDetail"> <view class="info"> <view class="img-box"> <image :src="item.associate.img"></image> </view> <view class="name"> {{item.associate.name}} </view> <view class="money"> ¥{{item.associate.sell_price}} <span>¥{{item.associate.market_price}}</span> </view> </view> </view> </view> </view> </view></view></template><script>
export default { data() { return { tipsData: '', tapIndex: 0 }; }, props: { healthData: { type: Array, value: '' }, title: { type: String, value: '' }, show: { type: Number, value: '' }, meta: { type: Object, value: "" } }, mounted() { this.tipsData= this.healthData[0]; } , //组件的方法
methods: { _changeItem(e) { var index = this.tapIndex; if (index == this.healthData.length - 1) { index = 0; } else { index++; } this.tipsData= this.healthData[0]; this.tapIndex= index; },
_jumpToDetail(e) { var id = e.currentTarget.dataset.id; wx.navigateTo({ url: `/pages/store/detail/detail?id=${id}` }); }, },
};</script>
<style rel="stylesheet/less" lang="less">@import "health-tips";</style>
|