<template>
	<view>
		<!-- 图片及其他 -->
		<view  v-if="detail.url">
			<view class="wrap" v-if="detail.url">
				<u-image @click="upImg(detail.url)" :src="detail.url" mode="widthFix"></u-image>
			</view>
			<u-card title="习性" margin="0 0 30rpx 0" v-if="detail.habits">
				<view class="textContent" slot="body">
					{{detail.habits || ''}}
				</view>
			</u-card>
			<u-card title="防治方法" margin="0 0 30rpx 0" v-if="detail.prevention">
				<view class="textContent" slot="body">
					{{detail.prevention || ''}}
				</view>
			</u-card>
		</view>
		<view class="empyt" v-else>
			<u-icon name="info-circle-fill" color="#ff9900" size="48"></u-icon>
			<text>暂无介绍，正在补充中~</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				detail: {
				}
			}
		},
		methods: {
			upImg(src) {
				uni.previewImage({
					urls: src,
				})
			},
		},
		onLoad(options) {
			this.detail = JSON.parse(options.pestName);
			uni.setNavigationBarTitle({
			  title: `${this.detail.title}介绍`  
			});

		},
	}
</script>

<style lang="scss">
	page {
		background: #f7f8fc;
		padding: 25rpx;
	}

	.wrap {
		width: 100%;
		margin-bottom: 30rpx;
		.u-image {
			display: block;
			margin: 0 auto;
			width: 730rpx;
			height: 450rpx;
			border-radius: 5px;
		}
	}
	.u-card{
		margin-bottom: 30rpx;
	}
	.u-card__body{
		border-top: 2rpx solid #e4e7ed;
	}
	.empyt{
		display: flex;
		height: 80vh;
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}
</style>