在开发的过程中,用到了节流,引入公共的节流,初始调用如下(报错了…)。
template中:

<button class="btn" @click="throttle(Submit(),500,2)" :disabled="!normalUse">创建</button>

JS文件只是引入:

import {throttle} from '../../../../utils/index'

以上代码,执行后的结果:

vconsole.min.js?aac1:10 [Vue warn]: Property or method "throttle" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.found in---> <Index> at src/views/mobile/conference/create/index.vue<Index> at src/views/mobile/home/index.vue<App> at src/App.vue<Root>
value @ vconsole.min.js?aac1:10
value @ vconsole.min.js?aac1:10
window.console.<computed> @ vconsole.min.js?aac1:10
value @ vconsole.min.js?aac1:10
value @ vconsole.min.js?aac1:10
window.console.<computed> @ vconsole.min.js?aac1:10
warn @ vue.runtime.esm.js?a593:619
warnNonPresent @ vue.runtime.esm.js?a593:2015
get @ vue.runtime.esm.js?a593:2070
click @ index.vue?508f:345
invokeWithErrorHandling @ vue.runtime.esm.js?a593:1854
invoker @ vue.runtime.esm.js?a593:2179
original._wrapper @ vue.runtime.esm.js?a593:6917
vconsole.min.js?aac1:10 [Vue warn]: Error in v-on handler: "TypeError: _vm.throttle is not a function"found in---> <Index> at src/views/mobile/conference/create/index.vue<Index> at src/views/mobile/home/index.vue<App> at src/App.vue<Root>
value @ vconsole.min.js?aac1:10
value @ vconsole.min.js?aac1:10
window.console.<computed> @ vconsole.min.js?aac1:10
value @ vconsole.min.js?aac1:10
value @ vconsole.min.js?aac1:10
window.console.<computed> @ vconsole.min.js?aac1:10
warn @ vue.runtime.esm.js?a593:619
logError @ vue.runtime.esm.js?a593:1884
globalHandleError @ vue.runtime.esm.js?a593:1879
handleError @ vue.runtime.esm.js?a593:1839
invokeWithErrorHandling @ vue.runtime.esm.js?a593:1862
invoker @ vue.runtime.esm.js?a593:2179
original._wrapper @ vue.runtime.esm.js?a593:6917
vconsole.min.js?aac1:10 TypeError: _vm.throttle is not a functionat click (eval at ./node_modules/_cache-loader@4.1.0@cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"e66113e6-vue-loader-template"}!./node_modules/_vue-loader@15.9.3@vue-loader/lib/loaders/templateLoader.js?!./node_modules/_cache-loader@4.1.0@cache-loader/dist/cjs.js?!./node_modules/_vue-loader@15.9.3@vue-loader/lib/index.js?!./src/views/mobile/conference/create/index.vue?vue&type=template&id=433df7bf&scoped=true& (7.js:155), <anonymous>:348:45)at invokeWithErrorHandling (vue.runtime.esm.js?a593:1854)at HTMLButtonElement.invoker (vue.runtime.esm.js?a593:2179)at HTMLButtonElement.original._wrapper (vue.runtime.esm.js?a593:6917)

虽然执行了,但是报错了!!!

解决方法如下:
写法错误,不能写在template中,要写在js代码块中,所以改动了下:
template:

 <button class="btn" @click="toCreate" :disabled="!normalUse">创建</button>

js 代码:

import {throttle} from '../../../../utils/index';  //引入节流
toCreate(){throttle(this.Submit(),400,2);},

这样就可以了,完成

[Vue warn]: Property or method “throttle“ is not defined on the instance but referenced during rende相关推荐

  1. [Vue warn]: Property or method index is not defined on the instance but referenced during render

    8月份开始团队使用 React,所以 Vue 很久没接触了,今天同事问我一个问题,发出来记录下 问题重现 一个输入键盘,keyUpHandle 为该触发事件函数,绑定 $event 和 index,在 ...

  2. [Vue warn]: Property or method id is not defined on the instance but referenced during render.

    这是上一篇文章使用v-for时出现的warn: Mr.J--Vue之v-for全解析 在查看官方文档之后:Vue.js 由于Vue不允许动态添加根级别的响应属性,因此必须通过预先声明所有根级别的响应数 ...

  3. vue.runtime.esm.js:4560 [Vue warn]: Property or method “item“ is not defined on the instance but

    报错异常 vue.runtime.esm.js:4560 [Vue warn]: Property or method "item" is not defined on the i ...

  4. vue.esm.js?efeb:571 [Vue warn]: Property or method subItem is not defined on the instance but refe

    报错信息 vue.esm.js?efeb:571 [Vue warn]: Property or method "subItem" is not defined on the in ...

  5. Vue抛 Property or method turn is not defined on the instance but referenced during render. 的解决方法

    如下图,Vue 抛: [Vue warn]: Property or method "turn" is not defined on the instance but refere ...

  6. vue.runtime.esm.js:619 [Vue warn]: Property or method “test“ is not defined on the instance but refe

    背景: 解决办法: 根据错误信息,发现是属性或方法"test"未在实例上定义,但在呈现过程中被引用.根据这条线索,可以打开lamp-list.vue文件,局部搜索该 test 关键 ...

  7. vue.runtime.esm.js:619 [Vue warn]: Property or method “XXX“ is not defined on the instance but refe

    需要引入到主仓库:

  8. uniapp小程序报错Property or method item is not defined on the instance but referenced during rende

    H5中不报错,但是小程序中报错 原因是定义的属性中没有这个东西,但是你使用,而且在他身上还使用了字符串相关的函数! 把这个去掉,完美解决

  9. Property or method xxxx is not defined on the instance but referenced during render.

    [Vue warn]: Property or method "getdata" is not defined on the instance but referenced dur ...

最新文章

  1. 线程队列,线程池和协程
  2. python中argsort,sort 和 sorted,operator.itemgetter函数
  3. 怎么看mysql有没有安装成功_MySQL 安装看这一篇就够了
  4. 最新数据显示,全国有580万人被限制乘坐高铁,大家怎么看?
  5. 摇滚java游戏_java 集合类
  6. LeetCode 45. 跳跃游戏 II(贪心/BFS,难)
  7. 【uTenux实验】写在开始实验之前
  8. 中国信通院发布《数据库发展研究报告(2021年)》(附报告和解读PPT下载)
  9. TYVJ P1073 加分二叉树 Label:区间dp
  10. 【王道计组笔记】Cache高速缓存基本工作原理
  11. WebService报错javax xml ws soap SOAPFaultException javax xml
  12. mybatis_Mapped Statements collection already contains value
  13. 科学研究设计一:什么是科学
  14. 积分墙广告平台接入指路
  15. 微信扫码登录详细操作流程(微信公众平台开发)
  16. 基金使用计划 数学建模 matlab,基金使用计划模型
  17. Dynamic , Static or Seperate Schema Design (Convert No-SQL to ORDBMS)
  18. 推广如何做网上引流?教你引流的底层逻辑
  19. 刚刚,一页马克思手稿在阿里拍卖上拍到了290万
  20. java和dba哪个好_你的性格适合做DBA吗?面试者必看

热门文章

  1. Java岗大厂面试百日冲刺 - 日积月累,每日三题【Day19】—— 集合框架3
  2. arp攻击与欺骗有什么区别_什么是欺骗(攻击)?
  3. 《财富》杂志评选的75本必读的最睿智的图书
  4. Flutter安卓系统把状态栏设置为透明色
  5. Fama-French五因子模型
  6. 传奇3服务器.gen文件,传奇3刺客4职业gsp国际版+教程+客户端
  7. EasyNVR接入EasyNVS显示授权超时是什么原因?如何解决?
  8. java数据结构20:Big Bang(链表的插入、删除、遍历和查找)
  9. 统计学(一): Z 分数 正态分布 (附 Python 实现代码) --Z 检验先修; Z 分数与正态分布两者关系; Z 分数与百分位数的异同;面试要点(以心理学实验为舟)
  10. JS TS 给函数注释的规范