vue 参数拼接没有值问题?-灵析社区

强哥喝假酒

vue 参数拼接没有值问题? 如下提交方法: handleHighSubmit(data) { this.serverData = { ...data } const new_str = [this.form.server_str, this.serverData.highServer].join(',') let params = { choice: this.choice, filter_condition: { server_str: new_str, ...this.form } } console.log(params, 'params---'); this.getCoverUsers(params) this.handleClose() }, 我在控制台打印的this.form.server_str值为字符串`'123'`和this.serverData.highServer的值为`‘[2-3]’`,它们都有值,,然后通过join拼接到一块当做参数传递,拼接后的值是'123,[2-3]',但是提交到接口为什么就只有this.form.server_str值,没有this.serverData.highServer的值

阅读量:18

点赞量:0

问AI
第一层你有打印params值。后面函数有把它传进去。之后再打印一次。看你需要的那个参数在不在。第一层有的话就是你后面又做啥处理给他截取了
,
用 Vue.nextTick : handleHighSubmit(data) { this.serverData = { ...data }; this.$nextTick(() => { const new_str = [this.form.server_str, this.serverData.highServer].join(','); let params = { choice: this.choice, filter_condition: { server_str: new_str, ...this.form } }; console.log(params, 'params---'); this.getCoverUsers(params); this.handleClose(); }); },