template div style=padding 0 250px 0 250px ; el-form ref=ruleFormRef model=ruleForm status-icon rules=rules label-width=120px class=demo-ruleForm el-form-item label=教师id prop=tid
在模板中,回显的数据是通过v-model绑定到ruleForm对象的属性上的。在代码中,ruleForm是一个响应式对象,通过ref进行定义和初始化。
如果回显的中文数据不显示,可能是因为在获取到的数据中,中文字符编码不正确导致无法正确显示。可以尝试在获取数据之后,使用decodeURIComponent进行解码,例如:
axios({
method: 'Get',
url: '/api/myInformationServlet',
params: { tid: localStorage.getItem('tid') }
}).then(function (result) {
console.log(result);
const decodedData = decodeURIComponent(result.data.data);
ruleForm.value = JSON.parse(decodedData);
console.log(ruleForm.value);
})
这样可以尝试对获取到的数据进行解码,然后再将解码后的数据赋值给ruleForm.value。这样应该可以正确显示中文数据
原文地址: http://www.cveoy.top/t/topic/iRAg 著作权归作者所有。请勿转载和采集!