【发布时间】:2020-09-05 19:07:25
【问题描述】:
有没有办法在提交时在数据返回中存储多个值。
查看
<div id="app">
<input type="text" v-model="inserted" placeholder="Insert Name">
<button type="submit" v-on:click='submit();'>SUBMIT</button>
</div>
脚本
new Vue({
el: "#app",
data: {
inserted:[], /** each name submitted should be stored over here **/
/** if the first name was submitted as DAVID and second name was submitted as JOHN **/
/** inserted[] should consists of both values as ["DAVID", "JOHN"] **/
},
methods: {
submit(){
console.log('value submitted');
}
}
})
下面是我在JSFIDDLE上的代码
【问题讨论】: