<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>使用key唯一令牌解决表单值混乱问题</title> <script src="vue.js"></script> </head> <body> <div id="lantian"> <template v-if="regType=='mail'"> 邮箱:<input type="text" key="mail-register" /> </template> <template v-else> 手机:<input type="text" key="phone-register" /> </template> <br /> <input type="radio" value="mail" v-model="regType" />邮箱注册 <input type="radio" value="phone" v-model="regType" />手机注册 </div> <script> var app=new Vue({ el:'#lantian', data:{ regType:'mail' } }); </script> </body> </html>