vue 中的@、@/和./的区别

本文详细介绍了Vue.js中事件绑定的使用方法,包括@符号作为v-on的简写,以及如何在标签内部添加事件绑定。文章强调了Vue实例中所有函数必须放置在methods对象中的重要性,否则将导致事件绑定失败。

@:表示vue语法中v-on的简写;绑定事件的专用格式。当事件触发的时候,函数才会来调用。

使用格式,在标签内部添加v-on:事件名="事件"

注意:Vue实例中所有的函数必须放在methods对象中,否则利用v-on绑定的事件,系统会报找不到该事件的错误

@ /:表示 src目录下;

. /:表示当前目录下;

 

ERROR in ./src/views/modules/forum/list.vue Invalid value used as weak map key @ ./src/router/router-static.js 17:1-47 76:13-18 @ ./src/main.js 10:0-47 84:2-8 ERROR in ./src/views/modules/forumreport/add-or-update.vue Invalid value used as weak map key @ ./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/modules/forumreport/list.vue?vue&type=script&lang=js 3:1-43 48:3-14 @ ./src/views/modules/forumreport/list.vue?vue&type=script&lang=js 1:0-163 1:179-182 1:184-344 1:184-344 @ ./src/views/modules/forumreport/list.vue 2:0-55 10:2-8 3:0-50 3:0-50 @ ./src/router/router-static.js 23:1-59 106:13-24 @ ./src/main.js 10:0-47 84:2-8 ERROR in ./src/views/modules/forumreport/list.vue Invalid value used as weak map key @ ./src/router/router-static.js 23:1-59 106:13-24 @ ./src/main.js 10:0-47 84:2-8 ERROR in ./src/views/modules/forumtype/add-or-update.vue Invalid value used as weak map key @ ./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/modules/forumtype/list.vue?vue&type=script&lang=js 3:1-43 44:3-14 @ ./src/views/modules/forumtype/list.vue?vue&type=script&lang=js 1:0-163 1:179-182 1:184-344 1:184-344 @ ./src/views/modules/forumtype/list.vue 2:0-55 10:2-8 3:0-50 3:0-50 @ ./src/router/router-static.js 18:1-55 81:13-22 @ ./src/main.js 10:0-47 84:2-8 ERROR in ./src/views/modules/forumtype/list.vue Invalid value used as weak map key @ ./src/router/router-static.js 18:1-55 81:13-22 @ ./src/main.js 10:0-47 84:2-8 ERROR in ./src/views/modules/huodongbaoming/add-or-update.vue Invalid value used as weak map key @ ./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/modules/huodongbaoming/list.vue?vue&type=script&lang=js 3:1-43 60:3-14 @ ./src/views/modules/huodongbaoming/list.vue?vue&type=script&lang=js 1:0-163 1:179-182 1:184-344 1:184-344 @ ./src/views/modules/huodongbaoming/list.vue 2:0-55 10:2-8 3:0-50 3:0-50 @ ./src/router/router-static.js 20:1-65 91:13-27 @ ./src/main.js 10:0-47 84:2-8 ERROR in ./src/views/modules/huodongbaoming/list.vue Invalid value used as weak map key @ ./src/router/router-static.js 20:1-65 91:13-27 @ ./src/main.js 10:0-47 84:2-8 ERROR in ./src/views/modules/huodongleixing/add-or-update.vue Invalid value used as weak map key @ ./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/modules/huodongleixing/list.vue?vue&type=script&lang=js 3:1-43 44:3-14 @ ./src/views/modules/huodongleixing/list.vue?vue&type=script&lang=js 1:0-163 1:179-182 1:184-344 1:184-344 @ ./src/views/modules/huodongleixing/list.vue 2:0-55 10:2-8 3:0-50 3:0-50 @ ./src/router/router-static.js 27:1-65 126:13-27 @ ./src/main.js 10:0-47 84:2-8 ERROR in ./src/views/modules/huodongleixing/list.vue Invalid value used as weak map key @ ./src/router/router-static.js 27:1-65 126:13-27 @ ./src/main.js 10:0-47 84:2-8 ERROR in ./src/views/modules/news/add-or-update.vue Invalid value used as weak map key @ ./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/modules/news/list.vue?vue&type=script&lang=js 3:1-43 46:3-14 @ ./src/views/modules/news/list.vue?vue&type=script&lang=js 1:0-163 1:179-182 1:184-344 1:184-344 @ ./src/views/modules/news/list.vue 2:0-55 10:2-8 3:0-50 3:0-50 @ ./src/router/router-static.js 14:1-45 61:13-17 @ ./src/main.js 10:0-47 84:2-8 ERROR in ./src/views/modules/news/list.vue Invalid value used as weak map key @ ./src/router/router-static.js 14:1-45 61:13-17 @ ./src/main.js 10:0-47 84:2-8 ERROR in ./src/views/modules/newstype/add-or-update.vue Invalid value used as weak map key @ ./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/modules/newstype/list.vue?vue&type=script&lang=js 3:1-43 44:3-14 @ ./src/views/modules/newstype/list.vue?vue&type=script&lang=js 1:0-163 1:179-182 1:184-344 1:184-344 @ ./src/views/modules/newstype/list.vue 2:0-55 10:2-8 3:0-50 3:0-50 @ ./src/router/router-static.js 28:1-53 131:13-21 @ ./src/main.js 10:0-47 84:2-8 ERROR in ./src/views/modules/newstype/list.vue Invalid value used as weak map key @ ./src/router/router-static.js 28:1-53 131:13-21 @ ./src/main.js 10:0-47 84:2-8 ERROR in ./src/views/modules/yonghu/add-or-update.vue Invalid value used as weak map key @ ./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/views/modules/yonghu/list.vue?vue&type=script&lang=js 5:1-43 61:3-14 @ ./src/views/modules/yonghu/list.vue?vue&type=script&lang=js 1:0-163 1:179-182 1:184-344 1:184-344 @ ./src/views/modules/yonghu/list.vue 2:0-55 10:2-8 3:0-50 3:0-50 @ ./src/router/router-static.js 19:1-49 86:13-19 @ ./src/main.js 10:0-47 84:2-8 ERROR in ./src/views/modules/yonghu/list.vue Invalid value used as weak map key @ ./src/router/router-static.js 19:1-49 86:13-19 @ ./src/main.js 10:0-47 84:2-8 ERROR in ./src/views/pay.vue Invalid value used as weak map key @ ./src/router/router-static.js 11:0-29 50:13-16 @ ./src/main.js 10:0-47 84:2-8 ERROR in ./src/views/register.vue Invalid value used as weak map key @ ./src/router/router-static.js 12:0-39 144:13-21 @ ./src/main.js 10:0-47 84:2-8 ERROR in ./src/views/update-password.vue Invalid value used as weak map key @ ./src/router/router-static.js 10:0-52 45:13-27 @ ./src/main.js 10:0-47 84:2-8 webpack compiled with 107 errors
09-11
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值