最近学习VUE结合ElementUI框架,在写函数的时候需要发一个post请求,但是之前的post请求都没问题,就这个post突然报错Cannot read property ‘adornUrl’ of undefined
TypeError: Cannot read property 'adornUrl' of undefined
at VueComponent.addCategory (category.vue?db70:81)
at VueComponent.invoker (vue.esm.js?efeb:2027)
at VueComponent.Vue.$emit (vue.esm.js?efeb:2538)
at VueComponent.handleClick (button.js?9ada:312)
at invoker (vue.esm.js?efeb:2027)
at HTMLButtonElement.fn._withTask.fn._withTask (vue.esm.js?efeb:1826)
问题JS写法
this.http({
url: this.http.adornUrl("/product/category/save"),
method: 'post',
data: this.http.adornData(this.category, false)
}).then(({ data }) => {...});
woca我的http前面的$ 符 号 呢 ? 这 里 使 用 的 v s c o d e , 把 一 些 常 用 的 脚 本 或 者 方 法 放 在 用 户 片 段 , 打 关 键 字 就 可 以 快 速 引 用 你 封 装 的 代 码 块 , 比 如 p o s t 请 求 g e t 请 求 等 等 。 这 里 系 统 自 动 把 我 的 符号呢?这里使用的vscode,把一些常用的脚本或者方法放在用户片段,打关键字就可以快速引用你封装的代码块,比如post请求get请求等等。这里系统自动把我的 符号呢?这里使用的vscode,把一些常用的脚本或者方法放在用户片段,打关键字就可以快速引用你封装的代码块,比如post请求get请求等等。这里系统自动把我的符号给去了,好坑,因为vscode使用 作 为 占 位 符 , 如 作为占位符,如 作为占位符,如{1}或者$ 1 , 都 可 以 让 你 的 用 户 片 段 在 加 载 后 直 接 把 鼠 标 光 标 放 到 那 里 , 所 以 需 要 加 1,都可以让你的用户片段在加载后直接把鼠标光标放到那里,所以需要加 1,都可以让你的用户片段在加载后直接把鼠标光标放到那里,所以需要加才能正常加载。
"Print to console": {
"prefix": "$httppost",
"body": [
"this.$$http({",