<template>
<div>
<!-- Dropdown for selecting an item based on tree data -->
<select v-model="selectedId" @change="updateCode">
<option v-for="item in flattenedTreeData" :key="item.id" :value="item.id">
{
{ item.name }}
</option>
</select>
<!-- Input for displaying the code of the selected item -->
<input v-model="code" />
</div>
</template>
<script>
import axios from 'axios';
export default {
data() {
return {
flattenedTreeData: [], // This will hold the flattened version of your tree data
selectedId: null, // This will hold the ID of the selected item from the dropdown
code: '', // This will hold the code that corresponds to the selected ID
};
},
async created() {
await this.fetchTreeDataFro
vue获取树形结构
最新推荐文章于 2024-07-25 09:24:40 发布