https://blog.csdn.net/qq_42345237/article/details/98348889
https://www.cnblogs.com/moqiutao/p/11440315.html

自己的代码

<template><div class="top"><div class="top_div"><div style="background-color:coral;"><img style="width: 50px;height: 50px" src="../assets/logo.png"></div><div class="top_b" style="background-color:lightblue;"><div v-for='(item,index) in arrl':class='{itemhover:index===isactivel}'@click='lfn(index)'>{{item}}</div></div></div><div id="left"><div class="left_div" style="background-color:coral;">{{arrl[isactivel]}}</div><div class="center_div" style="background-color:lightblue;"><div class="center_div_header"><div v-for='(item,index) in arr[isactivel]':class='{itemhover:index===isactive}'@click='fn(index)'>{{item}}</div></div><div class="center_div_body"><div v-show=show_list[index] v-for='(item,index) in arr[isactivel]':class='{itemdisplay :index===isactive}'><component :is="currentView"></component></div></div></div></div></div></template>
<script>import CommentSetting from './CommentSetting'export default {name: 'ting',table_title: [16, 17, 18, 19],data () {return {itemhoverindex: null,isactive: 0,isactivel: 0,isactivell: 0,arr: [['111','222','333','444'],['222','333','444','555'],['333','444','555','666'],['444','555','666','777']],arrl: ['111','222','333','444'],show_list: [1,0,0,0],cindex:0,table_list:['home','post','archive',"home"],}},methods: {lfn: function (index) {console.log(index)this.show_list=[0,0,0,0]this.show_list[0]=1this.isactive=0this.isactivel = indexthis.cindex=index},fn: function (index) {this.show_list=[0,0,0,0]this.show_list[index]=1this.isactive = index}},components: {'home':CommentSetting,"post":"","archive":""},computed:{currentView(){return this.table_list[this.cindex];}}}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>.top {border: 0;display: flex;flex-direction: row;}.top .top_div {border: 0;display: flex;flex-direction: column;}.top .top_div div {width: 150px;height: 50px;}#left {border: 0;display: flex;flex-direction: column;}.top #left .left_div{height:50px;}.top #left .center_div {height: 800px;width: 800px;display: flex;flex-direction: column;}.top #left .center_div .center_div_body {width: auto;height: 800px;}.top #left .center_div .center_div_header {width: auto;display: flex;flex-direction: row;}.top #left .center_div .center_div_header div {width: 80px;background-color: salmon;}.top .top_div .top_b {height: auto;border: 0;display: flex;flex-direction: column;}.top .top_div .top_b div {width: 150px;background-color: darkgray;}.itemhover {background-color: fuchsia !important;color: cornflowerblue !important;height: 50px;}.itemdisplay {display: block;height: 800px;background-color: burlywood;}
</style>

vue中动态渲染组件相关推荐

  1. 自己解决在Vue中动态渲染图片不显示的问题

    乐于助人 前言 分析思路 1. 绝对路径 2. 相对路径 总结 本篇文章记录的是自己在 Vue-Cli2 中如何去解决的这个问题,心里路程比较多,所以话比较多哈哈,感谢阅读,大概耗时2分钟 前言 如上 ...

  2. Vue中动态渲染输入框并v-model绑定后无法输入

    最近遇到一个根据后台返回来动态渲染表单的需求,但是input在v-model后无法输入了. 原因:Vue无法检测普通的新增属性 解决:通过this.$set()新增 <el-form :mode ...

  3. vue中动态添加组件

    效果: 代码: <template><div><div v-for="(item,index) in lst"><h4>{{item ...

  4. 【Vue】动态添加组件的两种实现

    在Vue项目中,想要动态为页面上添加组件,是一件十分容易就能够实现的事情,这必须要得益于Vue框架的强力支持! 但有时候往往就是由于事情变得简单起来后,却突然忘记了要如何去实现.这大概就是对代码走火入 ...

  5. VUE中动态改变字体大小

    VUE中动态改变字体大小 父组件将自己的数据传递送给子组件展示,子组件监听click操作,emit发送出去,父组件监听通过emit发送的信息,改变控制字体大小的postFontSize,通过style ...

  6. vue中动态引入图片为什么要是require, 你不知道的那些事

    相信用过vue的小伙伴,肯定被面试官问过这样一个问题:在vue中动态的引入图片为什么要使用require 有些小伙伴,可能会轻蔑一笑:呵,就这,因为动态添加src被当做静态资源处理了,没有进行编译,所 ...

  7. vue树形结构html,怎么在vue中利用递归组件实现一个树形控件

    怎么在vue中利用递归组件实现一个树形控件 发布时间:2021-06-11 17:26:48 来源:亿速云 阅读:81 作者:Leah 本篇文章为大家展示了怎么在vue中利用递归组件实现一个树形控件, ...

  8. 【Vue】Vue中的父子组件通讯以及使用sync同步父子组件数据

    前言: 之前写过一篇文章<在不同场景下Vue组件间的数据交流>,但现在来看,其中关于"父子组件通信"的介绍仍有诸多缺漏或者不当之处, 正好这几天学习了关于用sync修饰 ...

  9. vue使用html渲染组件,Vue.js在渲染组件之前填充数据

    我是Vue.js的新手,我试图创建一个没有成功的简单组件,它包含一个selectList,我试图填充它的选项数据来模拟Ajax请求,这是我的代码:Vue.js在渲染组件之前填充数据 HTML {{n. ...

最新文章

  1. codesmith用access的mdb文件作数据源的模板引用
  2. 图像上添加噪声 并滤波
  3. 十以内的加减java编写程序_Java实现随机出题,10道10以内加减法计算代码实例
  4. 操作系统(三十四)覆盖和交换
  5. 将Android应用程序打包
  6. perl调用shell命令并获取输出
  7. Python装饰器、metaclass、abc模块学习笔记
  8. 8.Python进阶_异常处理
  9. C/C++_宏定义神仙级用法 实现枚举字符串互转
  10. Java周记(第一周)
  11. idea替换和查找快捷键(看了不后悔系列)
  12. mvcnn代码详解_使用colab运行tensorflow版本的faster-rcnn
  13. 实现一个 柯里化函数
  14. C语言函数:tolower()、toupper字符大小写转换函数。
  15. CentOS 各版本的下载
  16. 实践练习四(必选):迁移 MySQL 数据到 OceanBase 集群
  17. java短信接口-单条短信接口
  18. 36套模具3D+2D原图+结构图
  19. Django实现刷新验证码功能
  20. 阿里云开发板HaaS510响应UART串口指令

热门文章

  1. html脚本语言有哪些,常见的脚本语言(有哪些)
  2. 计算机jsp外文文献,计算机 JSP web 外文翻译 外文文献 英文文献
  3. 西安交通大学2019计算机复试方案,西安交通大学2019年招收硕士研究生复试体检通知...
  4. c语言delay_C语言编程制作“古怪手电筒”,有光的时候就会亮,没光绝不会亮...
  5. matlab 转换 tfrecord,训练数据集与TFRecord互相转换的两种方式
  6. miniconda3 安装numpy_Miniconda“安装”numpy,但Python无法导入
  7. java joptionpanel_JOptionPane用法--java
  8. jffs2 告警 和 一般性错误
  9. php中location.reload,js刷新页面location.reload()用法详解
  10. cmw500综合测试仪使用_大屏幕真彩色互感器综合特性测试仪功能特点