vue渲染自定义json数据
<template>
<div class="wrap">
<div class="main">
<div class="main_left">
<ul v-for="(val,index) in list[0].type" @click="clc(index)">
<li>{{val.tit}}</li>
</ul>
</div>
<div class="main_right">
<ul v-for="(val,index) in list[0].type[this.indexs].datainfo">
<li>
<img :src="val.img" />
<span>{{val.name}}</span>
</li>
</ul>
</div>
</div>
</div>
</template>
<script>
import axios from "axios"
export default {
name: "tab1",
data() {
return {
indexs: "0",
list: [{
"type": [{
"tit": "常用",
"datainfo": [{
"img": "../../static/img/美食.png",
"name": "美食",
"datatype": "大众点评"
},
{
"img": "../../static/img/星巴克.png",
"name": "酒店",
"datatype": "房价-预定"
},
{
"img": "../../static/img/公交.png",
"name": "银行",
"datatype": ""
},
{
"img": "../../static/img/医院.png",
"name": "ATM",
"datatype": ""
},
{
"img": "../../static/img/银行.png",
"name": "公交地铁",
"datatype": ""
},
{
"img": "../../static/img/电影院.png",
"name": "团购",
"datatype": ""
},
{
"img": "../../static/img/超市.png",
"name": "超市",
"datatype": ""
},
{
"img": "../../static/img/加油站.png",
"name": "加油站",
"datatype": "折扣油价"
},
{
"img": "../../static/img/星巴克.png",
"name": "电影院",
"datatype": "影讯-预定"
},
{
"img": "../../static/img/星巴克 (1).png",
"name": "星巴克",
"datatype": ""
},
{
"img": "../../static/img/汉堡可乐.png",
"name": "麦肯比",
"datatype": ""
},
{
"img": "../../static/img/ktv (1).png",
"name": "KTV",
"datatype": ""
},
{
"img": "../../static/img/啤酒.png",
"name": "酒吧",
"datatype": ""
},
{
"img": "../../static/img/洗浴用具.png",
"name": "洗浴",
"datatype": ""
},
{
"img": "../../static/img/商场.png",
"name": "商场",
"datatype": ""
},
{
"img": "../../static/img/医院 (2).png",
"name": "医院",
"datatype": "大众点评"
},
{
"img": "../../static/img/卫生间 .png",
"name": "公厕",
"datatype": ""
}
]
},
{
"tit": "特色",
"datainfo": [{
"img": "../../static/img/酒店.png",
"name": "周边微博",
"datatype": "大众点评"
},
{
"img": "../../static/img/美食.png",
"name": "酒店",
"datatype": "房价-预定"
},
{
"img": "../../static/img/银行.png",
"name": "银行",
"datatype": ""
},
{
"img": "../../static/img/洗浴用具.png",
"name": "ATM",
"datatype": ""
},
{
"img": "../../static/img/公交 (1).png",
"name": "公交地铁",
"datatype": ""
},
{
"img": "../../static/img/团购.png",
"name": "团购",
"datatype": ""
},
{
"img": "../../static/img/超市 (1).png",
"name": "超市",
"datatype": ""
},
{
"img": "../../static/img/加油站 (1).png",
"name": "加油站",
"datatype": "折扣油价"
},
{
"img": "../../static/img/电影院 (1).png",
"name": "电影院",
"datatype": "影讯-预定"
},
{
"img": "../../static/img/星巴克 (1).png",
"name": "星巴克",
"datatype": ""
},
{
"img": "../../static/img/汉堡可乐.png",
"name": "麦肯比",
"datatype": ""
},
{
"img": "../../static/img/ktv (1).png",
"name": "KTV",
"datatype": ""
}
]
},
{
"tit": "餐饮",
"datainfo": [{
"img": "../../static/img/美食.png",
"name": "周边微博",
"datatype": "大众点评"
},
{
"img": "../../static/img/酒店.png",
"name": "酒店",
"datatype": "房价-预定"
},
{
"img": "../../static/img/银行.png",
"name": "银行",
"datatype": ""
},
{
"img": "../../static/img/洗浴用具.png",
"name": "ATM",
"datatype": ""
},
{
"img": "../../static/img/公交 (1).png",
"name": "公交地铁",
"datatype": ""
},
{
"img": "../../static/img/团购.png",
"name": "团购",
"datatype": ""
},
{
"img": "../../static/img/超市 (1).png",
"name": "超市",
"datatype": ""
}
]
},
{
"tit": "购物",
"datainfo": [{
"img": "../../static/img/美食.png",
"name": "周边微博",
"datatype": "大众点评"
},
{
"img": "../../static/img/酒店.png",
"name": "酒店",
"datatype": "房价-预定"
},
{
"img": "../../static/img/银行.png",
"name": "银行",
"datatype": ""
},
{
"img": "../../static/img/洗浴用具.png",
"name": "ATM",
"datatype": ""
}
]
},
{
"tit": "休闲",
"datainfo": [{
"img": "../../static/img/美食.png",
"name": "周边微博",
"datatype": "大众点评"
},
{
"img": "../../static/img/酒店.png",
"name": "酒店",
"datatype": "房价-预定"
},
{
"img": "../../static/img/银行.png",
"name": "银行",
"datatype": ""
},
{
"img": "../../static/img/洗浴用具.png",
"name": "ATM",
"datatype": ""
},
{
"img": "../../static/img/美食.png",
"name": "周边微博",
"datatype": "大众点评"
},
{
"img": "../../static/img/酒店.png",
"name": "酒店",
"datatype": "房价-预定"
},
{
"img": "../../static/img/银行.png",
"name": "银行",
"datatype": ""
},
{
"img": "../../static/img/洗浴用具.png",
"name": "ATM",
"datatype": ""
},
{
"img": "../../static/img/美食.png",
"name": "周边微博",
"datatype": "大众点评"
},
{
"img": "../../static/img/酒店.png",
"name": "酒店",
"datatype": "房价-预定"
},
{
"img": "../../static/img/银行.png",
"name": "银行",
"datatype": ""
},
{
"img": "../../static/img/洗浴用具.png",
"name": "ATM",
"datatype": ""
},
{
"img": "../../static/img/洗浴用具.png",
"name": "ATM",
"datatype": ""
}
]
},
{
"tit": "交通",
"datainfo": [{
"img": "../../static/img/美食.png",
"name": "周边微博",
"datatype": "大众点评"
},
{
"img": "../../static/img/酒店.png",
"name": "酒店",
"datatype": "房价-预定"
},
{
"img": "../../static/img/银行.png",
"name": "银行",
"datatype": ""
},
{
"img": "../../static/img/洗浴用具.png",
"name": "ATM",
"datatype": ""
},
{
"img": "../../static/img/美食.png",
"name": "周边微博",
"datatype": "大众点评"
}
]
},
{
"tit": "便民",
"datainfo": [{
"img": "../../static/img/美食.png",
"name": "周边微博",
"datatype": "大众点评"
},
{
"img": "../../static/img/酒店.png",
"name": "酒店",
"datatype": "房价-预定"
},
{
"img": "../../static/img/银行.png",
"name": "银行",
"datatype": ""
},
{
"img": "../../static/img/洗浴用具.png",
"name": "ATM",
"datatype": ""
},
{
"img": "../../static/img/美食.png",
"name": "周边微博",
"datatype": "大众点评"
},
{
"img": "../../static/img/美食.png",
"name": "周边微博",
"datatype": "大众点评"
},
{
"img": "../../static/img/酒店.png",
"name": "酒店",
"datatype": "房价-预定"
},
{
"img": "../../static/img/银行.png",
"name": "银行",
"datatype": ""
},
{
"img": "../../static/img/洗浴用具.png",
"name": "ATM",
"datatype": ""
},
{
"img": "../../static/img/美食.png",
"name": "周边微博",
"datatype": "大众点评"
},
{
"img": "../../static/img/美食.png",
"name": "周边微博",
"datatype": "大众点评"
},
{
"img": "../../static/img/酒店.png",
"name": "酒店",
"datatype": "房价-预定"
},
{
"img": "../../static/img/银行.png",
"name": "银行",
"datatype": ""
},
{
"img": "../../static/img/洗浴用具.png",
"name": "ATM",
"datatype": ""
},
{
"img": "../../static/img/美食.png",
"name": "周边微博",
"datatype": "大众点评"
}
]
}, {
"tit": "酒店",
"datainfo": [{
"img": "../../static/img/美食.png",
"name": "周边微博",
"datatype": "大众点评"
},
{
"img": "../../static/img/酒店.png",
"name": "酒店",
"datatype": "房价-预定"
}
]
},
{
"tit": "资讯",
"datainfo": [{
"img": "../../static/img/美食.png",
"name": "周边微博",
"datatype": "大众点评"
},
{
"img": "../../static/img/酒店.png",
"name": "酒店",
"datatype": "房价-预定"
},
{
"img": "../../static/img/美食.png",
"name": "周边微博",
"datatype": "大众点评"
},
{
"img": "../../static/img/酒店.png",
"name": "酒店",
"datatype": "房价-预定"
},
{
"img": "../../static/img/美食.png",
"name": "周边微博",
"datatype": "大众点评"
},
{
"img": "../../static/img/酒店.png",
"name": "酒店",
"datatype": "房价-预定"
}
]
}
]
}
]
}
},
methods: {
clc(index) {
this.indexs = index
}
}
}
</script>
<style type="text/css">
.main_left {
width: 30%;
height: 100vh;
float: left;
overflow: auto;
}
.main_left ul li {
width: 100%;
height: 1rem;
text-align: center;
line-height: 1rem;
font-size: 18px;
border-bottom: 1px solid #ccc;
}
.main_left ul li:hover {
background: #efefef;
}
.main_right {
width: 70%;
height: 100vh;
float: left;
overflow: auto;
}
.main_right ul li {
width: 100%;
height: 1rem;
line-height: 1rem;
font-size: 18px;
background: #efefef;
}
.main_right ul li img {
width: 1rem;
float: left;
}
</style>
<!-- Add "scoped" attribute to limit CSS to this component only -->
vue渲染自定义json数据的更多相关文章
- Vue+elementUI 自定义动态数据菜单导航组件实现展开收缩+路由跳转router-view渲染数据 路由跳转到同一个页面带参数ID 自动刷新数据
准备:导入ElementUI 看官网教程 数据准备:JSON数据转换成树状 参考文章: JS实现 JSON扁平数据转换树状数据 后台我拿的数据是这样的格式: [ {id:1 , parentId: 0 ...
- Asp.Net Core 轻松学-实现跨平台的自定义Json数据包
前言 在前后端分离的业务开发中,我们总是需要返回各种各样的数据包格式,一个良好的 json 格式数据包是我们一贯奉行的原则,下面就利用 Json.Net 来做一个简单具有跨平台的序列化数据包实 ...
- vue中引入json数据,不用本地请求
1.我的项目结构,需要在Daily.vue中引入daily.js中的json数据 2.把json数据放入一个js文件中,用exports导出,vscode的json格式太严格了,很多数据,调了一个多小 ...
- vue格式化显示json数据
已经是json格式数据的,直接用标签 <pre></pre>展示. 参考:https://www.jianshu.com/p/d98f58267e40
- vue请求本地json数据
1.下载vue-resource插件 cnpm install vue-resource 1.2全局引入vue-resource: 在main.js import VueResource from ' ...
- vue 渲染后更新数据
this.$set(this.selGetData,level,[{},{}])this.$set(this.selGetData,1,{message:"Test add attr&quo ...
- Vue之循环遍历Json数据,填充Table表格
简单记一次Vue循环遍历Json数据,然后填充到Table表格中,展示到前端的代码: async getData(id) { const res = await this.$store.api.new ...
- 将相关数据拼成所需JSON数据
参考: http://www.cnblogs.com/shuilangyizu/p/6019561.html 有时候我们需要将一些数据拼装成所需要格式的JSON,可以使用如下方法,本人觉得还是比较方便 ...
- vue服务端渲染axios预取数据
首先是要参考vue服务端渲染教程:https://ssr.vuejs.org/zh/data.html. 本文主要代码均参考教程得来.基本原理如下,拷贝的原文教程. 为了解决这个问题,获取的数据需要位 ...
随机推荐
- Android使用Fragment来实现TabHost的功能
http://www.cnblogs.com/tiantianbyconan/p/3360938.html 好了,到此为止,我们已经用Fragment实现了类似TabHost的功能了,下面来看下各个F ...
- Android学习——ViewPager的使用(二)
这一节介绍使用FragmentPagerAdapter适配器,来加载Fragment对象. 数据源 加载Fragment对象时,数据源自然来自Fragment,与View类似,依旧使用List来存放数 ...
- nagios外部命令接口
http://nagios.manubulon.com/traduction/docs14en/extcommands.html https://old.nagios.org/developerinf ...
- jsencrypt代码分析——openssl的rsa加密解密在js的实现
在js上做rsa,感觉jsencrypt这个是封装的比较好的,但用起来还是遇到了些坑,所以踩进代码里填填坑- 项目在这里 https://github.com/travist/jsencrypt [r ...
- python实现oracle数据泵导出功能
脚本如下:[oracle@ycr python]$ more dump.py #/usr/bin/python#coding:utf8 import sysimport osimport time n ...
- May 27th 2017 Week 21st Saturday
I learned the value of hard work by working hard. 只有真的努力了,才会知道努力的价值. I remember in the movie, The Da ...
- vue+node+mongodb实现的功能
用vue+node +mongodb实现前后台交互的页面代码,已经上传到github上, 地址是: https://github.com/GainLoss/vue-node-mongodb https ...
- 转一个csdn看到的帖子:而立之年的程序猿失业了 [问题点数:0分,结帖人jinxingfeng_cn]
http://bbs.csdn.net/topics/390612263?page=1#post-395768948
- WP模拟器修改语言为中文方法
对于WP7模拟器来说默认启动时显示的语言为英文,除了操作界面外,如果你的应用支持多国语言必须修改为中文才能显示正确的界面.下面Zune123将WP7 Emulator修改语言为中文的方法写个简单的教程 ...
- c#用链表存储并读取配置文件(代码部分)
//读取配置参数 private void loadcofig() { //List<param> camra1 = new List<param>(); List<st ...