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. 本文主要代码均参考教程得来.基本原理如下,拷贝的原文教程. 为了解决这个问题,获取的数据需要位 ...
随机推荐
- 关于easyui 圆角按钮在ie9不能隐藏
(一)在easyui框架里 在a标签里添加class='easyui-linkbutton' 如: (二)问题:在ie9里圆角背景overflow:hidden 不起作用 (a)框架内 html 部分 ...
- 图解JavaScript中的原型链
转自:http://www.jianshu.com/p/a81692ad5b5d typeof obj 和 obj instanceof Type 在JavaScript中,我们经常用typeof o ...
- matlab练习程序(Ritter‘s最小包围圆)
原始算法是sphere,我这里简化为circle了. Ritter's求最小包围圆为线性算法,因为非常简单,所以应用非常广泛. 该算法求出的圆比最优圆大概会大个5%到20%左右,求最优圆应该可以用Bo ...
- gamemakerstudio:鼠标输入
标准鼠标输入常量: mb_left 按下鼠标左键 mb_middle 按下鼠标中键 (这可能不是在所有目标平台上都有效) mb_right 按下鼠标右键 mb_none 没有按下任何鼠标键 mb_an ...
- lucene4.6版本配置
1.官网下载lucene的最新版本,解压后会看到很多文件,我们现在需要: E:\lucene-4.6.0\demo\lucene-demo-4.6.0.jar; E:\lucene-4.6.0\cor ...
- sqlserver内存管理之lazy writer
任何在缓冲区被修改的页都会被标记为“脏”页.将这个脏页写入到数据磁盘就是CheckPoint或者Lazy Writer的工作.前面就大体说了一下checkpoint,这会就简单的理解一下这个lazy ...
- Angular 5.x 学习笔记(2) - 生命周期钩子 - 暂时搁浅
Angular 5.x Lifecycle Hooks Learn Note Angular 5.x 生命周期钩子学习笔记 标签(空格分隔): Angular Note on cnblogs.com ...
- 再学UML-UML用例建模解析(三)
2. 编写用例文档 绘制用例图只是完成了用例建模最基本也是最简单的一步,用例建模的核心在于编写用例文档,用例文档又称为用例规约或用例描述.顾名思义,用例文档是用于描述用例的文档,每一个用例对应于一个用 ...
- Android开发最佳学习路线图(转)
Android开发总体路线图: 基础学习——JavaSE: 很多朋友一上手就开始学习Android,似乎太着急了一些. Android应用程序开发是以Java语言为基础的,所以没有扎实 ...
- 将nodeList转换为数组(兼容性)
将nodeList转换为数组(兼容性) function arrayofNodes(nodes){ var arr = null; try{ arr = Array.prototype.slice.c ...