vue + iviewadmin框架登录时报错cannot read property“token” of undefined

1.后台接口没有问题,一直报错token的问题,是因为用户权限的问题,iviewadmin框架只有super_admin和admin有管理权限,在src/mock/login.js中添加用户就可以了。(这是手动添加)

原文地址:https://www.cnblogs.com/ting0527/p/11671132.html

时间: 2024-07-31 05:16:22

vue + iviewadmin框架登录时报错cannot read property“token” of undefined的相关文章

使用vue-preview报错Cannot read property 'open' of undefined

最近在做一个vue项目中时,需要使用vue-preview插件制作缩略图,首先在终端使用npm i vue-preview -S指令安装了vue-preview插件,然后在main.js中,导入并引用: import VuePreview from 'vue-preview' Vue.use(VuePreview) 接着在需要用到vue-preview插件的组件中写入: <img class="preview-img" v-for="(item, index) in l

vue 数组对象取对象的属性: Cannot read property &#39;xxxx&#39; of undefined

{{ list[0].name }} list[0]没有定义 能正确打印出想要的结果,但就是报错,外面套个v-for就没错了 很费解 与异步有关,解决办法: <template v-if=list[0]> {{ list[0].name }} </template> https://www.v2ex.com/amp/t/402145 vue 数组对象取对象的属性: Cannot read property 'xxxx' of undefined 原文地址:https://www.c

Vue(踩坑)vue.esm.js?efeb:628 [Vue warn]: Error in render: &quot;TypeError: Cannot read property &#39;0&#39; of undefined&quot; found in

1.项目报错如下 2.原因: 异步显示的数据先显示vuex中的初始数据,再显示请求的数据,一开始在vuex中state中的初始数据为空,报错是因为在显示初始数据的时候报错 3.解决:避免在没有数据的时候显示解析(有数据才解析) 有数据的时候div才存在,用v-if控制一下 5.总结:表达式有一层表达式(a),二层表达式(a.b),三层表达式(a.b.c), 当表达式三层的时候就有问题:比如a开始为空,a.b:的结果为undefined, a.b.c你再取的时候就会报错了 Vue(踩坑)vue.e

ionic-native sqlite 插件5.x版的在ionic3.x上报错 cannot read property &#39;split&#39; of undefined

话说ionic是真坑,文档质量就很差,版本兼容性也不好.最近要搞ionic sqlite开发,期间遇到问题: ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'split' of undefinedTypeError: Cannot read property 'split' of undefined 根据报错发现是调用 sqlite.create 方法时报的, 在stackoverflow上找到了答案 ht

UEditor使用报错Cannot set property &#39;innerHTML&#39; of undefined

仿用UEditor的setContent的时候报错,报错代码如下Uncaught TypeError: Cannot set property 'innerHTML' of undefined.调试ueditor.config.js,ueditor.all.js 提示me.body is undefined.(我就纳了闷儿了!同样的使用那个行这个咋就不行,那个有body,view,这个咋就这么少![我还查看了插件的内部函数,真是个good媛~])错误的原因是没有等UEditor创建完成就使用UE

Chrome下使用百度地图报错Cannot read property &#39;minZoom&#39; of undefined

问题:工作中在Google chome下面的js console里面测试百度地图API var map = new BMap.Map("container"); map.centerAndZoom(new BMap.Point(116.404, 39.915), 11); TypeError: Cannot read property 'minZoom' of undefined message: "Cannot read property 'minZoom' of unde

echarts报错Cannot read property &#39;features&#39; of undefined

引入地图的时候 echarts2报错: Uncaught Error: [MODULE_MISS]"echarts/src/util/mapData/params" is not exists! 原因不明,但是感觉和缺js文件有关(因为echarts3报错就是因为缺少了world.js) echarts3报错: Uncaught TypeError: Cannot read property 'features' of undefined 原因如下:缺少world.js,然后成功: 完

vue2.XX 提示[Vue warn]: Error in render: &quot;TypeError: Cannot read property &#39;img&#39; of undefined&quot;

item 是向后台请求的一条数据,里面包含img,但是却提示img未定义 父组件向子组件传递数据时, 子组件 具体代码: <img :src="item.img" /> 提示: 出现的原因: 可能是页面渲染和请求数据是异步操作, 数据还未请求结束,页面已经开始渲染了,所以刚开始报未定义变量, 等数据获取结束后,再次渲染,页面内容出来了,但是刚开始的警告也出来了 解决办法: 1. <img :src="item && item.imgUrl&q

在使用resetField 报错Cannot read property &#39;indexOf&#39; of undefined

elementUI  的resetField  是对对整个表单进行重置,将所有字段值重置为初始值并移除校验结果 ,当内容不一致 或找不到内容时 就会报错,具体原因举例如下: 原因1:ruleForm 内部数据 与实际页面需要验证的数据不一致 比如:下面例子 页面需要的是name ,而 ruleForm定义的是name2,当单词不小心写错就会报这个问题 <el-form ref="newFormModel" :rules="rules" :model="