vue.js中报错: TypeError: Cannot read property 'indexOf' of undefined
来源:互联网 发布:mysql 获取上一年月份 编辑:程序博客网 时间:2024/05/29 07:56
[Vue warn]: Error when evaluating expression "name.indexOf('jack') >= 0": TypeError: Cannot read property 'indexOf' of undefined
ypeError: Cannot read property 'indexOf' of undefined,从这句话中indexOf()是一个函数,但是却不能识别该属性,说明引用对象出错。
代码如下所示:
<!doctype html><!DOCTYPE html><html><head><title>dd</title></head><body><!-- view --><div id="app"><h1 v-if="yes">yes</h1><h1 v-if="no">no</h1><h1 v-if="age>=25">Age:{{age}}</h1><h1 v-if="name.indexOf('jack') >= 0">Name:{{name}}</h1></div></body><script type="text/javascript" src="vue.js"></script><script type="text/javascript">// viewModelvar vm = new Vue({el:"#app",data:{yes:true,no:false,age:27,naem:"jack"}})</script></html>
总结:ypeError: Cannot read property 'indexOf' of undefined,一般情况是引用对象属性出错
阅读全文
1 0
- vue.js中报错: TypeError: Cannot read property 'indexOf' of undefined
- "TypeError: Cannot read property 'undefined' of undefined"
- background.js Uncaught TypeError: Cannot read property 'xxx' of undefined
- TS/JS错误:TypeError: Cannot read property 'prototype' of undefined
- TypeError: Cannot read property 'parentNode' of undefined
- TypeError: Cannot read property 'left' of undefined
- TypeError: Cannot read property 'newLine' of undefined
- TypeError: Cannot read property 'password' of undefined
- TypeError: Cannot read property 'query' of undefined
- Extjs4---Uncaught TypeError: Cannot read property ‘items’ of undefined
- 【StackFlow】Uncaught TypeError: Cannot read property 'pageCount' of undefined
- Ckeditor: Uncaught TypeError: Cannot read property 'keyCode' of undefined 解决方法
- Uncaught TypeError: Cannot read property 'msie' of undefined问题解决方案
- Uncaught TypeError: Cannot read property 'options' of undefined 错误
- Uncaught TypeError: Cannot read property 'length' of undefined
- 错误:Uncaught TypeError: Cannot read property 'WebSocket' of undefined
- Uncaught TypeError: Cannot read property 'value' of undefined
- Uncaught TypeError: Cannot read property 'plugin' of undefined
- java处理时区的注意事项
- Linux Mysql 1130错误解决
- 在homestead下创建laravel/lumen项目
- tf.transpose
- js入门,和程序基础
- vue.js中报错: TypeError: Cannot read property 'indexOf' of undefined
- https://wenku.baidu.com/view/1f9138e903d8ce2f01662306.html
- c/c++失配指针
- map
- 浮点型的存储方式
- 修改eclipse字体大小
- AndroidStudio工程中的build.gradle中的buildTypes、productFlavors的多构建、多渠道打包APK
- device setup classes和device interface classes区别
- Nginx实现高并发优化