<template>
	<view class="icon-title-navBar-box">
		<view @click="handleBack" class="nav-bar-icon"></view>
		<text class="nav-bar-title">单词详解</text>
	</view>
	<view>
		<view>
			{{pageInfo.name}}
		</view>
		<view>
			<text>
				通用释义
			</text>
			<text  v-for="(item,index) in pageInfo.xiangyi" :key="index">
				<text>
					{{item}}
				</text>
			</text>
		</view>
		<view>
			<text>
				实用口语
			</text>
			<text  v-for="(item,index) in pageInfo.kouyu" :key="index">
				<text>
					{{item.en}}
					{{item.zn}}
				</text>
			</text>
		</view>
	</view>
</template>

<script setup>
	import {
		reactive,
		ref,
		onMounted
	} from 'vue';
	import {
		getWordInfo
	} from "@/api/word.js"
	import {
		onLoad
	} from '@dcloudio/uni-app';
	const goXiangjie = () => {

	}
	const pageInfo = ref({
		kouyu: [],
		xiangyi: [],
		name: ''
	})
	const data = ref(null)


	onLoad((options) => {
		getInfo(options)
		data.value = options
	})
	const handleBack = () => {
		uni.redirectTo({
			url: `/pages/newEnglish/index?jieId=${data.value.jieId}&wordId=${data.value.wordId}`
		});
	}
	const getInfo = (data) => {
		let req = {
			jieId: data.jieId,
			wordId: data.wordId
		}
		getWordInfo(req).then(res => {
			console.log('res', res);
			pageInfo.value = res.data
		})
	}
</script>

<style>
</style>