this.$set(this.treatmentStatu, 'checked', value)
时间: 2024-04-24 20:26:45 浏览: 95
这段代码是在Vue中使用的,用于更新一个对象的属性值。具体来说,`this.$set`方法用于将`value`的值赋给`treatmentStatu.checked`属性。这样做的目的是为了确保当`treatmentStatu.checked`的值发生变化时,视图能够及时更新。在这段代码中,`this.treatmentStatu`是一个对象,`checked`是该对象的一个属性,`value`是要赋给`checked`属性的新值。通过调用`this.$set`方法,可以实现将新值赋给属性并触发视图更新的效果。
#### 引用[.reference_title]
- *1* [uniapp双向绑定switch开关选择器](https://blog.csdn.net/weixin_43807076/article/details/92798489)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
相关问题
this.$Axios.post提交表单
this.$Axios.post提交表单是指使用Axios库中的post方法来提交表单数据。在引用\[2\]和引用\[3\]中都提到了使用Axios库的post方法来发送POST请求。具体的使用方法是通过调用this.$axios.post(url, data)来发送POST请求,其中url是请求的地址,data是要发送的表单数据。在引用\[2\]中的代码示例中,使用了this.axios.post("user_login.php", data)来提交表单数据。而在引用\[3\]中的代码示例中,使用了this.$axios.post('/user/login', this.$qs.stringify({ login_account: this.loginForm.username, password: this.loginForm.password, remark: this.checked === true ? 'autologin' : 'nocheck' }))来提交表单数据。所以,this.$Axios.post提交表单的具体实现可以参考这两个代码示例。
#### 引用[.reference_title]
- *1* *2* [vue项目分析--this.$store.dispatch()&this.$store.commit()&vuex.store()](https://blog.csdn.net/weixin_46045444/article/details/120720528)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [axios发送post请求,提交表单数据](https://blog.csdn.net/weixin_30670925/article/details/98508087)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
methods: { submitForm(formName) { this.$refs[formName].validate((valid) => { if (valid) { this.$get("/admin", this.ruleForm) .then((res) => { if (res.data.status) { if (this.checked){ localStorage.setItem("remember",JSON.stringify(this.ruleForm)); } this.$msg(`${res.data.admin.username} ,登陆成功`, "success") sessionStorage.setItem("admin", JSON.stringify(res.data.admin)) this.$router.push("/admin/home") } else { this.$msg(res.data.msg, "error") } })
这是一个Vue.js组件的methods对象,其中包含一个名为submitForm的方法。方法中使用了this.$refs来引用表单组件,调用了validate方法进行表单验证。如果验证通过,则使用this.$get方法发送一个GET请求到/admin路径,并将表单数据作为请求参数。请求成功后,根据响应数据判断是否登录成功,如果成功则使用this.$msg方法弹出提示框,将管理员信息存储到sessionStorage中,并使用this.$router.push方法跳转到管理员首页;否则使用this.$msg方法弹出错误提示框。如果选中了记住密码,则使用localStorage.setItem方法将表单数据存储到本地。
阅读全文
相关推荐
















