classMap[seller.supports[$index].type]中的$index问题

来源:16-15 详情弹层页(6)- header剩余组件实现(上)

ZZ辉

2016-12-02

classMap[seller.supports[$index].type]和{{seller.supports[$index].description}}出错http://szimg.mukewang.com/584134ff0001168413520619.jpg

但我改为classMap[seller.supports[0].type]和{{seller.supports[0].description}}的时候,可以展示

http://szimg.mukewang.com/584135660001646804140634.jpg

请问$index哪里出了问题

写回答

3回答

ZZ辉

提问者

2016-12-02

原来是vue2.0舍弃了$index,改为以下代码就可以了。

//szimg.mukewang.com/584136c400018d9506900122.jpg

9
3
酒足饭饱勾二嫂
感觉直接写成classMap[item.type]和item.description也可以啊。好像比这样写要简单很多
2017-03-19
共3条回复

igsnow

2017-11-09

close

0
0

qq_爆米花配可乐_0

2016-12-05

请教下,当我用classMap的时候,报错classMap未被定义,是什么意思

0
7
shiny_jun
回复
ZZ辉
我也遇到这种问题了,按照你的方法把$去掉后依然报错 Property or method "index" is not defined on the instance but referenced during render.
2018-02-11
共7条回复

Vue.js2.5+cube-ui重构饿了么App(经典再升级)

掌握Vue1.0到2.0再到2.5最全版本应用与迭代,打造极致流畅的WebApp

9868 学习 · 4162 问题

查看课程