原因大概是openMenu和closeMenu里要对this.openedMenus进行数组操作,但是有时候取到的this.openedMenus不是数组类型而是字符串
我暂时的处理方法是在进行push或slice等方法之前判断type,然后转换为数组:
var n=this.openedMenus;(typeof(n)==='string')&&(this.openedMenus=n.substring(1,n.length-1).split(','));
但是还是希望能找到为什么类型会出现字符串的原因,从根本上解决该问题。
请给 demo
附件是本地静态页demo
用的是1.1.6版本的element-ui
index.js是原本js;
index_.js是我修改后的js,已经不会报错了
原始邮件
发件人:杨奕[email protected]
收件人:ElemeFE/[email protected]
抄送:Young [email protected]; [email protected]
发送时间:2017年2月16日(周四) 10:49
主题:Re: [ElemeFE/element] [bug]在使用了default-openeds参数时,index.js会出现报错 (#2851)
请给 demo
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
这里看不见附件
代码中的 default-openeds="[1,2]" 改成 :default-openeds="['1', '2']"
原因参考 Vue 文档中 v-bind 相关内容。
@Leopoldthecoder thanks a lot ,your advice helped me
Most helpful comment
代码中的
default-openeds="[1,2]"改成:default-openeds="['1', '2']"原因参考 Vue 文档中
v-bind相关内容。