1.使用update更改內(nèi)容時(shí),輸入字段的過(guò)程中點(diǎn)回車(chē),刪除,空格等鍵都會(huì)導(dǎo)致自動(dòng)退出編輯模式,有什么好辦法可以解決這個(gè)問(wèn)題嗎?2.還有就是使用delete刪除的時(shí)候,如果下一行有內(nèi)容展開(kāi),會(huì)自動(dòng)收起,這又得如何解決?具體代碼如下:<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>樹(shù)形視圖擴(kuò)展</title> <style> body { font-family: Menlo, Consolas, monospace; color: #444; } .item { cursor: pointer; } .bold { font-weight: bold; } ul { padding-left: 1em; line-height: 1.5em; list-style-type: dot; } </style> <script src="https://cdn.bootcss.com/vue/2.4.2/vue.min.js"></script></head><body><script type="text/x-template" id="item-template"> <li> <div :class="{bold: isFolder}" @click="toggle" @dblclick="changeType"> <span v-if="up">{{ model.name }}</span> <input v-else type="text" v-model="model.name" @click.stop> <span v-if="isFolder">[{{ open ? '-' : '+' }}]</span> <span class="bold" @click.stop="$emit('del', index)">[del]</span> <span class="bold" @click.stop="upd">[update]</span> </div> <ul v-if="isFolder" v-show="open"> <item class="item" v-for="(item, index) in model.children" :key="index + item.name" :index="index" :model="item" @del="model.children.splice($event, 1)"></item> <li class="add" @click="addChild">+</li> </ul> </li></script><p>樹(shù)形結(jié)構(gòu)</p><ul id="demo"> <item class="item" v-for="(model, index) in treeData" :key="index + model.name" :index="index" :model="model" @del="treeData.splice($event, 1)"></item></ul><script> var data = [ {name: 'han'}, {name: 'wang'}, { name: 'liu', children: [ {name: 'zhang'}, {name: 'lu'} ] } ]; Vue.component('item', { template: '#item-template', props: { model: Object, index: Number },