初学者请多多包涵
请问下面的DeviceInfo里引用了CpuInfo,在前端页面怎么赋值呢
使用device.cpu.total在前端页面连输入都不让输,输入以后直接给我清空了
```
type CpuInfo struct{
Total int 'json:"total"'
Around string 'json:"around"'
}
```
```
type DeviceInfo struct{
Version String
Serial String
Cpu *CpuInfo
}
```
前端vue页面:
```
<p>CPU: <input type="text" v-model.trim="device.cpu.total"></p>
<p>序列号: <input type="text" v-model.trim="device.model"></p>
<script>
new Vue({
el: "#app",
data: {
device: {
cpu:'',
serial:'',
},
message: '',
},
methods: {
updateAndBack: function() {
this.update();
},
update: function() {
this.message = "adding";
return $.ajax({
url: "/devices/addphone",
method: "post",
dataType: 'json',
ContentType: 'application/json',
data: JSON.stringify(this.device)
})
.then(function(ret) {
console.log(ret)
this.message = "Adding success !!"
}.bind(this))
},
cancel: function() {
window.location = "/";
}
}
})
</script>
```