【发布时间】:2022-08-16 13:54:54
【问题描述】:
目前我想将数据从编辑页面传递到添加页面。所以我使用{path: \'/test/admin/clinicvisit/add\', query:{id:this.$route.params.id}} 传递查询。我能够使用查询将数据传递到添加页面,但是有时刷新几次时数据可能不存在。有没有办法让数据保持一致地留在添加页面中?
add.vue
async testRoute(){
let visitId = this.$route.query.id
if (visitId){
let clinicVisit = await this.api.medical.viewClinicVisit(visitId)
this.inputs = await this.api.medical.optionsClinicVisit()
this.$set(this.inputs.staff, \"item_text\", \"username\")
this.$set(this.inputs.staff, \"item_value\", \"id\")
this.$set(this.inputs.staff, \"items\", await this.api.profile.listStaff({}))
if(clinicVisit.staff){
this.$set(this.inputs.staff, \"value\", clinicVisit.staff)
this.$set(this.inputs.staff, \"tmp_value\", clinicVisit.staff_detail.name)
}
mounted()
{
this.testRoute()
}
-
为什么不将其存储在浏览器“localStorage”中?
-
我如何存储在浏览器本地存储中?
标签: javascript vue.js