本文摘自PHP中文网,作者coldplay.xixi,侵删。
vue.js遍历map的方法:vue使用【v-for】遍历Map,代码为【<div class="area" v-for="(item, key) of cities" :key="key">】。
本教程操作环境:windows10系统、vue2.9,本文适用于所有品牌的电脑。
【相关文章推荐:vue.js】
vue.js遍历map的方法:
对象数据如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | "cities" : {
"A" : [{
"id" : 56,
"spell" : "aba" ,
"name" : "阿坝"
}, {
"id" : 57,
"spell" : "akesu" ,
"name" : "阿克苏"
}],
"B" : [{
"id" : 58,
"spell" : "baiyin" ,
"name" : "白银"
}, {
"id" : 59,
"spell" : "bangbu" ,
"name" : "蚌埠"
}],
"C" : [{
"id" : 60,
"spell" : "chengdu" ,
"name" : "成都"
}, {
"id" : 61,
"spell" : "cangzhou" ,
"name" : "沧州"
}]
|
阅读剩余部分
相关阅读 >>
vue.js如何操作dom
vue.js怎么获取class
怎么使用npm下载vue.js
浅谈安装vue.js的三种方式
vue如何进行事件处理?相关基础知识介绍
vue.js能做pc端吗
vue.js如何判断对象是否为空
angularjs和vue.js有什么差异?简单对比
vue.js能用正则表达式吗
vue.js中怎么添加图片
更多相关阅读请进入《vue.js》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » vue.js如何遍历map