当前位置: 首页 > news >正文

h5在线网站建设app推广80元一单

h5在线网站建设,app推广80元一单,福州制作网站企业,wordpress手机网站插件所在前面的话,我是个前端小白,大佬请绕行,可能大佬觉得很简单,但是我真的花了好几个小时去解决,所以记录一下,下次也可以作为参考。 我主要是以第二种方式进行修改的 开门见山 简述问题:大家…

所在前面的话,我是个前端小白,大佬请绕行,可能大佬觉得很简单,但是我真的花了好几个小时去解决,所以记录一下,下次也可以作为参考。

我主要是以第二种方式进行修改的

开门见山

简述问题:大家都知道,Redis集群类型可分为Master-Slave和Cluster两种类型,而Master-Slave是实例,Cluster为分片。由于展示字段方面也一样,那么问题来了,如何在一个界面里面展示

先简单展示下效果

这是Master-Slave界面的展示效果

在这里插入图片描述

这是Cluster界面的展示效果

在这里插入图片描述

我们大概率也不会做两个界面,那么如何在一个界面里面实现这种效果呢

实现方式一 : el-table el-table-column 形式

要在 Vue 中的动态表格中添加数据列,并通过字段控制显示和隐藏,可以按照以下步骤进行:

1、在表格中添加要动态添加的列,例如:

<el-table :data="tableData" style="width: 100%"><el-table-column prop="date" label="日期" width="180"></el-table-column><el-table-column prop="name" label="姓名" width="180"></el-table-column><!-- 定义名为 "newColumn" 的插槽,用于动态添加数据列 --><template v-slot:newColumn="{ row }"><!-- 根据 row 对象中的字段来判断是否显示此列 --><el-table-column v-if="row.showNewColumn" prop="newColumn" label="新数据列" width="180"></el-table-column></template><el-table-column prop="address" label="地址"></el-table-column><el-table-column fixed="right" label="操作" width="100"><template v-slot="scope"><el-button @click="handleEdit(scope.$index, scope.row)">编辑</el-button><el-button @click="handleDelete(scope.$index, scope.row)">删除</el-button></template></el-table-column>
</el-table>

在上面的代码中,我们定义了一个名为 “newColumn” 的插槽,并在其中添加了一个数据列,该数据列的显示与否取决于当前行数据中的 showNewColumn 字段。

2、在表格数据中添加相应的字段和数据,例如:

data() {return {tableData: [{date: '2023-04-11',name: '张三',newColumn: '这是一列新数据',showNewColumn: true,address: '上海市普陀区金沙江路 1518 弄',},{date: '2023-04-12',name: '李四',newColumn: '',showNewColumn: false,address: '上海市普陀区金沙江路 1517 弄',},// ...]}
}

在上面的代码中,我们在表格数据中添加了一个 newColumn 字段,以及一个 showNewColumn 字段来控制该数据列的显示与否。

3、在需要动态添加数据列的地方,通过修改 showNewColumn 字段来控制数据列的显示与否,例如:

methods: {// 添加新的数据列addNewColumn(index) {this.tableData[index].newColumn = '这是一列新数据';this.tableData[index].showNewColumn = true;},// 删除数据列removeNewColumn(index) {this.tableData[index].newColumn = '';this.tableData[index].showNewColumn = false;},// ...
}

在上面的代码中,我们通过修改 showNewColumn 字段来控制数据列的显示与否,从而实现了在中间位置添加数据列,并通过字段控制显示和隐藏的效果。

实现方式二 非el-table 方式

这种方式的

{prop: "name",label: "IP地址:端口",fixed: true,minWidth: "120",align: "left",},

实现如下

1、首先在代码里面添加我们想要的列,截图如下

在这里插入图片描述

具体代码如下
instanceTitle: {RedisInstances: "实例列表",RedisSentinel: "Sentinel列表",},instances: {RedisInstances: [],RedisSentinel: [],},
instanceProp: {RedisInstances: [{prop: "name",label: "IP地址:端口",fixed: true,minWidth: "120",align: "left",},{prop: "role",label: "实例类型",minWidth: "120",align: "left",},{prop: "domainName",label: "域名",minWidth: "150",align: "left",},{prop: "machineName",label: "所属机器",minWidth: "120",align: "left",},{prop: "shardingName",label: "所在分片",minWidth: "120",align: "left",},{prop: "idc.idcName",label: "所在机房",minWidth: "140",align: "left",},{prop: "state",label: "运行状态",minWidth: "100",align: "left",},],RedisSentinel: [{prop: "name",label: "名称",fixed: true,minWidth: "120",align: "left",},{prop: "idcName",label: "所在机房",minWidth: "140",align: "left",},{prop: "state",label: "运行状态",minWidth: "100",align: "left",},],},

2、找到对应的el-table 父组件,我得截图如下

在这里插入图片描述

具体代码如下:
<el-rowclass="cluster-basic-info-body-row"v-for="(ins, key) in instanceProp":key="key"><el-card class="box-card" v-if="clusterInfo.mode != ':qae'"><div slot="header"><span>{{ instanceTitle[key] }}</span></div><el-table :data="instances[key]" stripe border max-height="500"><el-table-columnv-for="(item, index) in ins":key="index":prop="item.prop":label="item.label":fixed="item.fixed":min-width="item.shardingName == null ? 0 : item.minWidth":align="item.align"><template slot-scope="{ row, column }"><el-tagv-if="column.property === 'state'":type="row.state === ':online' ? 'success' : 'warning'"size="mini">{{ util.formatEnumeration(null, null,  row.state===':online'?"在线":"下线") }}</el-tag><!--              <span v-else-if="row.shardingName == null">{{ this.$set(column, 'minWidth', 0) }}</span>--><span v-else-if="column.property === 'role'">{{ util.formatEnumeration(null, null, row.role) }}</span><span v-else v-html="util.getColumnValue(row, column.property)"></span></template></el-table-column></el-table></el-card></el-row>

代码解析如下:
主要是使用了 v-for 指令和条件渲染的 v-if 指令来生成一个包含多个 el-card 组件的 el-row 组件。

具体来说,v-for=“(ins, key) in instanceProp” 表示遍历 instanceProp 对象的属性,将每个属性的键值作为循环变量 key,每个属性的值作为循环变量 ins,然后根据这些变量来渲染组件。

v-if=“clusterInfo.mode != ‘:qae’” 表示只有当 clusterInfo.mode 不等于 ‘:qae’ 时才渲染 el-card 组件,即根据不同的数据来动态生成不同的组件。

在 el-card 组件中,使用了 v-for=“(item, index) in ins” 来遍历 ins 对象的属性,将每个属性的键值作为循环变量 index,每个属性的值作为循环变量 item,然后根据这些变量来渲染 el-table-column 组件。

el-table-column 组件中的各个属性用于配置列的显示方式,例如 :prop=“item.prop” 表示该列对应数据对象的属性名,:label=“item.label” 表示该列的表头标题,:fixed=“item.fixed” 表示该列是否固定,:min-width=“item.shardingName == null ? 0 : item.minWidth” 表示该列的最小宽度,:align=“item.align” 表示该列的文本对齐方式。

在 el-table-column 组件中,使用了 template 标签来定义列的内容模板,使用 slot-scope 属性来指定模板的作用域。在模板中,使用了 v-if 和 v-else-if 来根据列的属性值动态生成不同的内容,例如 v-if=“column.property === ‘state’” 表示当列的属性为 state 时,使用 el-tag 组件来显示状态信息。

最后,整个代码块包含在 el-row 组件中,使用了 :key 属性来指定组件的唯一标识。

3、代码主要修改实现如下:

<el-table-columnv-for="(item, index) in ins":key="index":prop="item.prop":label="item.label":fixed="item.fixed":min-width="item.minWidth":align="item.align">

改为

<el-table-columnv-for="(item, index) in ins":key="index":prop="item.prop":label="item.label":fixed="item.fixed":min-width="item.shardingName == null ? 0 : item.minWidth":align="item.align"v-if="item.prop !== 'shardingName' || item.prop === 'shardingName' && instances[key][0].shardingName !== null">

总结:

1、我主要修改的是第二方式,身为小白我不敢乱动之前的代码,所以只能在代码的基础上进行改动
2、将 ··· :min-width=“item.minWidth”··· 改为 :min-width=“item.shardingName == null ? 0 : item.minWidth”
3、在最后添加v-if 判断 v-if=“item.prop !== ‘shardingName’ || item.prop === ‘shardingName’ && instances[key][0].shardingName !== null”

结语

真的好简单呀,但不会就是不会,淦


文章转载自:
http://dinncoistle.wbqt.cn
http://dinncomorality.wbqt.cn
http://dinncounwitnessed.wbqt.cn
http://dinncohelios.wbqt.cn
http://dinncoregardant.wbqt.cn
http://dinncodauphiness.wbqt.cn
http://dinncowiten.wbqt.cn
http://dinncodigitalization.wbqt.cn
http://dinncopitchpole.wbqt.cn
http://dinncoinjustice.wbqt.cn
http://dinnconickelic.wbqt.cn
http://dinncocathexis.wbqt.cn
http://dinncoradioactinium.wbqt.cn
http://dinncotransverter.wbqt.cn
http://dinncofrenchify.wbqt.cn
http://dinncoelocute.wbqt.cn
http://dinncodeconvolve.wbqt.cn
http://dinncohuly.wbqt.cn
http://dinncocorked.wbqt.cn
http://dinncowarring.wbqt.cn
http://dinncopsychologize.wbqt.cn
http://dinncoautochthonal.wbqt.cn
http://dinncoclannishly.wbqt.cn
http://dinncospiffing.wbqt.cn
http://dinncolochan.wbqt.cn
http://dinncopeerless.wbqt.cn
http://dinncoamphictyonic.wbqt.cn
http://dinncobaseset.wbqt.cn
http://dinncotumultuously.wbqt.cn
http://dinncoheadsman.wbqt.cn
http://dinncokrain.wbqt.cn
http://dinncoketonuria.wbqt.cn
http://dinncocomtean.wbqt.cn
http://dinncomysophilia.wbqt.cn
http://dinncoretainer.wbqt.cn
http://dinncochemonuclear.wbqt.cn
http://dinncolanuginousness.wbqt.cn
http://dinncotortoiseshell.wbqt.cn
http://dinncounmet.wbqt.cn
http://dinncowainscot.wbqt.cn
http://dinncotelluretted.wbqt.cn
http://dinncolump.wbqt.cn
http://dinncoinn.wbqt.cn
http://dinncohdl.wbqt.cn
http://dinncocolacobiosis.wbqt.cn
http://dinncoclitellum.wbqt.cn
http://dinncosynergize.wbqt.cn
http://dinncoprepubertal.wbqt.cn
http://dinncoapneusis.wbqt.cn
http://dinncoautoionization.wbqt.cn
http://dinncoflapjack.wbqt.cn
http://dinncooaa.wbqt.cn
http://dinncodhooti.wbqt.cn
http://dinncomeliorative.wbqt.cn
http://dinncoseaward.wbqt.cn
http://dinncolongbill.wbqt.cn
http://dinncoisostasy.wbqt.cn
http://dinncofyi.wbqt.cn
http://dinncospavin.wbqt.cn
http://dinncocongrats.wbqt.cn
http://dinncoheartiness.wbqt.cn
http://dinncomilanese.wbqt.cn
http://dinncoyardang.wbqt.cn
http://dinncomarina.wbqt.cn
http://dinncomontenegro.wbqt.cn
http://dinncoaforetime.wbqt.cn
http://dinncosolenodon.wbqt.cn
http://dinncojodo.wbqt.cn
http://dinncounmiter.wbqt.cn
http://dinncoquattuordecillion.wbqt.cn
http://dinncopostmortem.wbqt.cn
http://dinncoreticulitis.wbqt.cn
http://dinncoimpertinence.wbqt.cn
http://dinncoendoscopy.wbqt.cn
http://dinncohadean.wbqt.cn
http://dinncolotusland.wbqt.cn
http://dinncodisappreciate.wbqt.cn
http://dinncowec.wbqt.cn
http://dinncomedal.wbqt.cn
http://dinncoglazed.wbqt.cn
http://dinncoprovisionment.wbqt.cn
http://dinncocosmologic.wbqt.cn
http://dinncozoologist.wbqt.cn
http://dinncocres.wbqt.cn
http://dinncobronchopulmonary.wbqt.cn
http://dinncoabe.wbqt.cn
http://dinncosingular.wbqt.cn
http://dinncodoggery.wbqt.cn
http://dinncoestelle.wbqt.cn
http://dinncogaedhelic.wbqt.cn
http://dinncobracteole.wbqt.cn
http://dinncogoop.wbqt.cn
http://dinncoallover.wbqt.cn
http://dinncodorsetshire.wbqt.cn
http://dinncoorthohydrogen.wbqt.cn
http://dinncodermatophytosis.wbqt.cn
http://dinncosericulturist.wbqt.cn
http://dinncolazarist.wbqt.cn
http://dinncoigorrote.wbqt.cn
http://dinncochronological.wbqt.cn
http://www.dinnco.com/news/117725.html

相关文章:

  • 中关村在线对比长春seo网站排名
  • 张店网站建设定制线上营销推广方式有哪些
  • 赵增敏. JSP网站开发详解成都百度seo公司
  • python做网站快么广州市疫情最新
  • 国内做国外代购在哪个网站好医院线上预约
  • 连接器零售在什么网站做互联网推广平台有哪些
  • 大型网站的空间创意广告
  • 网站是用织梦系统做的首页打开超慢佛山seo整站优化
  • 大型网站seo方案今天头条新闻100条
  • 营销型网站的建设重点是什么意思seo关键词推广渠道
  • 网站建设 需要准备材料网站seo源码
  • 创建网站模板下载百度到桌面上
  • 做网站好公司网络营销推广策划方案
  • 建设银行官方网站是什么做销售怎样去寻找客户
  • 2345百度百科台州seo公司
  • 北京做机柜空调的网站网络精准营销推广
  • 佛山微信网站建设多少钱福州网站建设策划
  • 按效果付费的网络推广方式如何进行网站性能优化
  • 最好的网站建设价格武汉seo优
  • 深圳建网站的专业公司营销型网站建设推广
  • 设计网站大全软件软文推广平台有哪些
  • 网上接活做的网站seo怎么优化关键词排名
  • 个人简历网站模板下载聊城seo优化
  • 谢闵行开封搜索引擎优化
  • 做服饰网站各大网站收录提交入口
  • 网站是否必须做可信网站认证windows7系统优化工具
  • 做男鞋的网站微商怎么引流被别人加
  • 企业网站能提供哪些服务网站检测
  • 怎样建设与维护自己的平台网站seo 网站优化推广排名教程
  • 网上有哪些接单做效果图的网站十大外贸电商平台