自定义多级联动选择器指南(uni-app)
- 多端支持:可以运行在H5、APP、微信小程序还是支付宝小程序,都可以轻松使用改组件。
- 自定义配置:您可以根据需要配置选择器的级数,使其适应不同的数据结构和用例。
- 无限级联:此组件支持无限级联选择,使您能够创建具有复杂数据结构的选择器。
参数 | 类型 | 描述 | 默认值 | 必选 |
---|---|---|---|---|
title | string | 标题 | ‘’ | 否 |
layer | number | 控制几级联动 | 1 | 否 |
data | array | 数据:[{name: ‘’, id: ‘’, children: [{name: ‘’, id: ‘’}]}] | [] | 否 |
接口返回数据结构:
[{id: 47, name: "工厂1", parentId: 0, type: 0},{id: 48, name: "区域1", parentId: 47, type: 0},{id: 19, name: "设备1", parentId: 48, type: 1}
]
处理后数据结构:
[{ id: 47, name: "工厂1", parentId: 0, type: 0,children: [{ id: 48, name: "区域1", parentId: 47, type: 0,children: [{ id: 19, name: "设备1", parentId: 48, type: 1 }] }]
}]
引用示例:
<template><view class="container"><view @click="bindDevice">选择设备</view><cascade-picker ref="picker" :title="cascadePicker.title" :layer="cascadePicker.layer" :data="cascadePicker.data" @callback="pickerCallback"></cascade-picker></view>
</template>
<script>
import cascadePicker from '@/components/cascade-picker/cascade-picker.vue';
import {handleTree} from "@/utils/tree";
export default {components: {cascadePicker},data() {return {deviceArr: [],deviceId: '',cascadePicker: {title: 'picker标题',layer: null,data: []}}},onLoad() {this.getDeviceSimpleList()},methods: {// 获取设备列表getDeviceSimpleList() {getDeviceSimpleList().then(res => {this.deviceArr = handleTree(res.data)})},// 打开设备选择器bindDevice() {const _this = this;_this.cascadePicker.data = _this.deviceArr;_this.$refs.picker.open().then(function() {console.log('打开成功');});},// picker多级联动回调pickerCallback(e) {const {data} = e;const lastItem = data[data.length - 1];this.deviceId = lastItem.id;}}
}
</script>
@/utils/tree
文件中的handleTree
方法
/*** 构造树型结构数据* @param {*} data 数据源* @param {*} id id字段 默认 'id'* @param {*} parentId 父节点字段 默认 'parentId'* @param {*} children 孩子节点字段 默认 'children'* @param {*} rootId 根Id 默认 0*/
export function handleTree(data, id = 'id', parentId = 'parentId', children = 'children', rootId = 0) {rootId = rootId || Math.min.apply(Math, data.map(item => {return item[parentId]})) || 0//对源数据深度克隆const cloneData = JSON.parse(JSON.stringify(data))//循环所有项const treeData = cloneData.filter(father => {let branchArr = cloneData.filter(child => {//返回每一项的子级数组return father[id] === child[parentId]});branchArr.length > 0 ? father.children = branchArr : '';//返回第一层return father[parentId] === rootId;});return treeData !== '' ? treeData : data;
}
cascade-picker
组件完整代码:
在
components
文件夹下创建cascade-picker
文件夹,然后在此文件夹下创建cascade-picker.vue
- 多级联动组件
<template name="cascade-picker"><view class="aui-picker" v-if="SHOW" :class="{'aui-picker-in': FADE==1,'aui-picker-out': FADE==0}"><view class="aui-mask" @click.stop="close"></view><view class="aui-picker-main"><view class="aui-picker-header"><view class="aui-picker-header-icon" @click.stop="close">取消</view><view class="aui-picker-title" v-if="title">{{ title }}</view><view class="aui-picker-header-icon aui-picker-confirm" @click.stop="_confirm">确认</view></view><view class="aui-picker-nav"><view class="aui-picker-navitem"v-if="nav.length>0"v-for="(item, index) in nav":key="index":data-index="index":class="[index==navCurrentIndex ? 'active' : '', 'aui-picker-navitem-'+index]":style="{margin: nav.length>2 ? '0 10px 0 0' : '0 30px 0 0'}"@click.stop="_changeNav($event)">{{ item.name }}</view><view class="aui-picker-navitem":key="nav.length":data-index="nav.length":class="[nav.length==navCurrentIndex ? 'active' : '', 'aui-picker-navitem-'+nav.length]":style="{margin: nav.length>2 ? '0 10px 0 0' : '0 30px 0 0'}"@click.stop="_changeNav($event)">请选择</view><view class="aui-picker-navborder" :style="{left: navBorderLeft+'px'}"></view></view><view class="aui-picker-content"><view class="aui-picker-lists"><view class="aui-picker-list"v-for="(list, index) in queryItems.length + 1":key="index":data-index="index":class="[index==navCurrentIndex ? 'active' : '']"><view class="aui-picker-list-warp" v-if="index == 0"><view class="aui-picker-item"v-for="(item, key) in items"v-if="item.pid=='0'":key="key":data-pindex="index":data-index="key":data-id="item.id":data-pid="item.pid":data-name="item.name":data-type="item.type":class="{'active': result.length>index && result[index].id==item.id}":style="{'background': touchConfig.index==key && touchConfig.pindex==index ? touchConfig.style.background : ''}"@click.stop="_chooseItem($event)"@touchstart="_btnTouchStart($event)"@touchmove="_btnTouchEnd($event)"@touchend="_btnTouchEnd($event)">{{ item.name }}</view></view><view class="aui-picker-list-warp" v-else><view class="aui-picker-item"v-for="(item, key) in queryItems[index-1]":key="key":data-pindex="index":data-index="key":data-id="item.id":data-pid="item.pid":data-name="item.name":data-type="item.type":class="{'active': result.length>index && result[index].id==item.id}":style="{'background': touchConfig.index==key && touchConfig.pindex==index ? touchConfig.style.background : ''}"@click.stop="_chooseItem($event)"@touchstart="_btnTouchStart($event)"@touchmove="_btnTouchEnd($event)"@touchend="_btnTouchEnd($event)">{{ item.name }}</view></view></view></view></view></view></view>
</template><script>
export default {name: 'cascade-picker',props: {title: { //标题type: String,default: ''},layer: { //控制几级联动,默认无限级(跟随数据有无下级)type: Number,default: null},data: { //数据 如:[{id: '', name: '', children: [{id: '', name: ''}]}]type: Array,default() {return [// [{id: '', name: '', children: [{id: '', name: ''}]}]]}}},data() {return {SHOW: false,FADE: -1,nav: [],items: [], // 第一级数据列表queryItems: [], // 各级数据列表navCurrentIndex: 0, // 当前选中的导航项索引navBorderLeft: 35, // 导航栏的边框左侧位置result: [],touchConfig: {index: -1,pindex: -1,style: {color: '#214579',background: '#EFEFEF'}},selectedData: [] // 用于回显数据的属性}},watch: {data() {const _this = this;const data = _this.data;_this.items = _this._flatten(data, '0')}},methods: {// 打开open() {const _this = this;_this.reset(); //打开时重置pickerreturn new Promise(function (resolve, reject) {_this.SHOW = true;_this.FADE = 1;resolve();});},// 关闭close() {const _this = this;return new Promise(function (resolve, reject) {_this.FADE = 0;const _hidetimer = setTimeout(() => {_this.SHOW = false;_this.FADE = -1;clearTimeout(_hidetimer);resolve();}, 100)});},//重置reset() {const _this = this;_this.queryItems = [];_this.nav = [];_this.navBorderLeft = 35;_this.navCurrentIndex = 0;_this.result = [];},//导航栏切换_changeNav(e) {const _this = this;const index = Number(e.currentTarget.dataset.index);_this.navCurrentIndex = index;const _el = uni.createSelectorQuery().in(this).select(".aui-picker-navitem-" + index);_el.boundingClientRect(data => {_this.navBorderLeft = data.left + 20;}).exec();},//数据选择_chooseItem(e) {const _this = this;const id = e.currentTarget.dataset.id;const name = e.currentTarget.dataset.name;const pid = e.currentTarget.dataset.pid;const type = e.currentTarget.dataset.type;const _arr = [];_this.result[_this.navCurrentIndex] = {id: id, name: name, pid: pid, type: type};if ((!_this._isDefine(_this.layer) && _this._isDefine(_this._deepQuery(_this.data, id).children))||(_this.navCurrentIndex < (Number(_this.layer) - 1) && _this._isDefine(_this._deepQuery(_this.data, id).children))) { //有下级数据_this._deepQuery(_this.data, id).children.forEach(function (item, index) {_arr.push({id: item.id, name: item.name, pid: id, type: item.type});});if (_this.navCurrentIndex == _this.queryItems.length) { //选择数据_this.queryItems.push(_arr);_this.nav.push({name: name});} else { //重新选择数据_this.queryItems.splice(_this.navCurrentIndex + 1, 1);_this.nav.splice(_this.navCurrentIndex + 1, 1);_this.queryItems.splice(_this.navCurrentIndex, 1, _arr);_this.nav.splice(_this.navCurrentIndex, 1, {name: name});}_this.navCurrentIndex = _this.navCurrentIndex + 1;const _el = uni.createSelectorQuery().in(this).select(".aui-picker-navitem-" + _this.navCurrentIndex);setTimeout(() => {_el.boundingClientRect(data => {_this.navBorderLeft = data.left + 20;}).exec();}, 100)} else { //无下级数据且最后一级数据的type为1时,则可以确认关闭_this._confirm();}},_confirm() {const _this = this;const lastItem = _this.result[_this.result.length - 1];if (lastItem && lastItem.type === 1) {_this.close().then(() => {_this.$emit("callback", {status: 0, data: _this.result});});} else {uni.$u.toast('请选择设备')}},//递归遍历——将树形结构数据转化为数组格式_flatten(tree, pid) {return tree.reduce((arr, {id, name, type, children = []}) =>arr.concat([{id, name, pid, type}], this._flatten(children, id)), [])},//根据id查询对应的数据(如查询id=10100对应的对象)_deepQuery(tree, id) {let isGet = false;let retNode = null;function deepSearch(tree, id) {for (let i = 0; i < tree.length; i++) {if (tree[i].children && tree[i].children.length > 0) {deepSearch(tree[i].children, id);}if (id === tree[i].id || isGet) {isGet || (retNode = tree[i]);isGet = true;break;}}}deepSearch(tree, id);return retNode;},/***判断字符串是否为空@param {string} str 变量@example: aui.isDefine("变量");*/_isDefine(str) {if (str == null || str == "" || str == "undefined" || str == undefined || str == "null" || str == "(null)" || str == 'NULL' || typeof (str) == 'undefined') {return false;} else {str = str + "";str = str.replace(/\s/g, "");if (str == "") {return false;}return true;}},_btnTouchStart(e) {const _this = this,index = Number(e.currentTarget.dataset.index),pindex = Number(e.currentTarget.dataset.pindex);_this.touchConfig.index = index;_this.touchConfig.pindex = pindex;},_btnTouchEnd(e) {const _this = this,index = Number(e.currentTarget.dataset.index),pindex = Number(e.currentTarget.dataset.pindex);_this.touchConfig.index = -1;_this.touchConfig.pindex = -1;},}
}
</script><style lang="scss" scoped>
/* ====================多级联动弹窗=====================*/
.aui-picker {width: 100vw;height: 100vh;//opacity: 0;position: fixed;top: 0;left: 0;z-index: 999;/* display: none; */
}// 遮罩层
.aui-mask {width: 100%;height: 100%;background: rgba(0, 0, 0, .3);position: absolute;left: 0;top: 0;z-index: 999;
}.aui-picker.aui-picker-in {-moz-animation: aui-fade-in .1s ease-out forwards;-ms-animation: aui-fade-in .1s ease-out forwards;-webkit-animation: aui-fade-in .1s ease-out forwards;animation: aui-fade-in .1s ease-out forwards;
}.aui-picker.aui-picker-out {-moz-animation: aui-fade-out .1s ease-out forwards;-ms-animation: aui-fade-out .1s ease-out forwards;-webkit-animation: aui-fade-out .1s ease-out forwards;animation: aui-fade-out .1s ease-out forwards;
}.aui-picker-main {width: 100vw;height: 50vh;background: #FFF;//border-radius: 15px 15px 0 0;position: absolute;left: 0px;bottom: 0;z-index: 999;
}.aui-picker.aui-picker-in .aui-picker-main {-moz-animation: aui-slide-up-screen .2s ease-out forwards;-ms-animation: aui-slide-up-screen .2s ease-out forwards;-webkit-animation: aui-slide-up-screen .2s ease-out forwards;animation: aui-slide-up-screen .2s ease-out forwards;
}.aui-picker.aui-picker-out .aui-picker-main {-moz-animation: aui-slide-down-screen .2s ease-out forwards;-ms-animation: aui-slide-down-screen .2s ease-out forwards;-webkit-animation: aui-slide-down-screen .2s ease-out forwards;animation: aui-slide-down-screen .2s ease-out forwards;
}.aui-picker-header {width: 100%;min-height: 50px;position: relative;z-index: 999;display: flex;justify-content: space-between;align-items: center;&-icon {font-size: 15px;color: #aaa;padding: 0 15px;}.aui-picker-confirm {height: 50px;line-height: 50px;text-align: center;font-size: 15px;color: $custom-content-color;padding: 0 15px;}
}.aui-picker-header::after {content: '';width: 100%;height: 1px;background: rgba(100, 100, 100, .3);-moz-transform: scaleY(.3);-ms-transform: scaleY(.3);-webkit-transform: scaleY(.3);transform: scaleY(.3);position: absolute;left: 0;bottom: 0;z-index: 999;
}.aui-picker-title {line-height: 20px;text-align: center;font-size: 17px;color: #333;padding: 15px;box-sizing: border-box;position: absolute;left: 50px;right: 50px;top: 0;
}.aui-picker-content {width: 100%;height: -webkit-calc(100% - 100px);height: calc(100% - 100px);
}.aui-picker-nav {width: 100%;height: 50px;text-align: left;padding: 0 15px;margin: 0 0 1px 0;justify-content: flex-start;white-space: nowrap;box-sizing: border-box;position: relative;overflow-x: scroll;overflow-y: hidden;
}.aui-picker-nav::after {content: '';width: 100%;height: 1px;background: rgba(100, 100, 100, .3);-moz-transform: scaleY(.3);-ms-transform: scaleY(.3);-webkit-transform: scaleY(.3);transform: scaleY(.3);position: absolute;left: 0;bottom: 0;z-index: 999;
}.aui-picker-navitem {width: 80px;line-height: 50px;font-size: 16px;margin: 0 30px 0 0;text-align: center;display: inline-block;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;
}.aui-picker-navitem.active {color: $custom-content-color;
}.aui-picker-navborder {width: 40px;height: 3px;background: $custom-content-color;border-radius: 5px;transition: left .15s;position: absolute;left: 40px;bottom: 0;
}.aui-picker-lists {width: 100%;height: 100%;justify-content: space-around;white-space: nowrap;
}.aui-picker-list {width: 100%;height: 100%;overflow: hidden;overflow-y: scroll;display: none;vertical-align: top;
}.aui-picker-list.active {display: inline-block;
}.aui-picker-list-warp {width: 100%;height: auto;box-sizing: border-box;padding: 15px 0;display: inline-block;
}.aui-picker-item {width: 100%;height: 50px;line-height: 50px;padding: 0 15px;box-sizing: border-box;font-size: 15px;color: #333;position: relative;
}.aui-picker-item.active {color: $custom-content-color;
}.aui-picker-item.active::after {content: '✔';font-size: 15px;color: $custom-content-color;position: absolute;top: 0px;right: 10px;
}</style>
总结
自定义多级联动选择器组件将有助于您在uni-app
中创建灵活的选择器,以满足各种不同平台和级数的需求。如果有任何问题、反馈或需要进一步的帮助,请不要犹豫,在下面的评论中提出。期待听到您的声音,以便改进和完善这个组件。
相关文章:

自定义多级联动选择器指南(uni-app)
多端支持:可以运行在H5、APP、微信小程序还是支付宝小程序,都可以轻松使用改组件。自定义配置:您可以根据需要配置选择器的级数,使其适应不同的数据结构和用例。无限级联:此组件支持无限级联选择,使您能够创…...
RHCE笔记-SSH服务
一.对称加密与非对称加密 1.1对称加密 1. 原理 对称加密是指加密和解密使用相同的密钥。也就是说,发送方和接收方在通信之前需要共享一个秘密密钥,使用这个密钥对数据进行加密和解密。 2. 常见算法 AES (Advanced Encryption Standard):…...
java实现文件分片上传并且断点续传
文章目录 什么是断点续传后端实现JAVA实现大文件分片上传断点续传 什么是断点续传 用户上传大文件,网络差点的需要历时数小时,万一线路中断,不具备断点续传的服务器就只能从头重传,而断点续传就是,允许用户从上传断线的地方继续传…...
leetcode hot100 之【LeetCode 15. 三数之和】 java实现
LeetCode 15. 三数之和 题目描述 给你一个包含 n 个整数的数组 nums,判断 nums 中是否存在三个元素 a,b,c 使得 a b c 0?请你找出所有和为 0 且不重复的三元组。 注意: 答案中的三元组可以按任意顺序组织。在 n…...
mysql学习教程,从入门到精通,sql序列使用(45)
sql序列使用 在SQL中,序列(Sequence)是一种数据库对象,用于生成唯一的数值,通常用于自动递增的主键。不同的数据库管理系统(DBMS)对序列的支持和语法可能有所不同。以下是一些常见的DBMS&#…...
Java 中的异常处理、常见异常、如何自定义异常类、Checked 和 Unchecked 异常的区别、如何处理数据库事务中的异常
文章目录 1. 异常的基本概念与处理方法定义常见异常类补充说明: 异常处理方法示例 2.如何自定义异常类步骤示例 3. Java 中的 Checked 和 Unchecked 异常的区别Checked 异常Unchecked 异常示例 4. 如何处理数据库事务中的异常常见场景处理方式示例讨论 总结 异常是指…...

6.1 特征值介绍
一、特征值和特征向量介绍 本章会开启线性代数的新内容。前面的第一部分是关于 A x b A\boldsymbol x\boldsymbol b Axb:平衡、均衡和稳定状态;现在的第二部分是关于变化的。时间会加入进来 —— 连续时间的微分方程 d u / d t A u \pmb{\textrm{d}…...

Vue01
前端最新Vue2Vue3基础入门到实战项目全套教程,自学前端vue就选黑马程序员,一套全通关!_哔哩哔哩_bilibilihttps://www.bilibili.com/video/BV1HV4y1a7n4?spm_id_from333.788.videopod.episodes&vd_source016213ecd945408976ff307a6bda30…...

MySQL - Navicat自动备份MySQL数据
对于从事IT开发的工程师,数据备份我想大家并不陌生,这件工程太重要了!对于比较重要的数据,我们希望能定期备份,每天备份1次或多次,或者是每周备份1次或多次。 如果大家在平时使用Navicat操作数据库&#x…...

系统分析师20:【案例特训专题3】系统设计与运维
1 Web开发 1.1 Web开发涉及技术的综合应用 高性能高可用可维护应变安全 1.2 Web系统架构演化过程 1.2.1 单台机器到数据库与Web服务器分离 早期的web系统往往以单台机器形态出现,web网站无论是前端还是后台数据库都部署在一台服务器上,部署起来比较…...
Linux 局域网中使用NTP配置时间服务
一:NTP 时间服务器配置 前提: 局域网环境中一般不能直接使用互联网上提供的时间服务器,例如ntp.aliyun.com。所以可以使用局域网中的一个服务器时间为基准,其他服务器的时间都和他保持一致。 1、将服务器的系统时间配置为时间源…...
Shiro会话管理和加密
一、会话相关API及会话使用 Shiro提供了完整的企业级会话管理功能,不依赖于底层容器(如Web容器Tomcat),可以在JavaSE和JavaEE环境中使用。会话相关API主要包括: Subject.getSession(): 获取当前用户的会话࿰…...

GPON、XG-PON和XGS-PON的区别
类别GPON10G PON 细分 GPON XG-PON XGS-PON 下行速率 2.488 Gbps 9.953 Gbps 9.953Gbps 上行速率 1.244 Gbps 2.488 Gbps 9.953Gbps 可用带宽 2200Mbps 8500Mbps 8500Mbps 1000Mbps2000Mbps8500Mbps ITU-T标准 G.984(2003年) G.987 &a…...
Spring 项目返回值枚举类编写技巧
Spring 项目返回值枚举类编写技巧 在 Spring 项目中,使用枚举类来统一管理返回值和状态码是一种非常优雅的实现方式。这不仅能提升代码的可读性和维护性,还能避免在代码中硬编码字符串或数字来表示状态码。本文将以 ReturnCodeEnum 为例,介绍…...

【操作系统】06.进程控制
一、进程创建 1.1 认识fork函数 在linux中fork函数是非常重要的函数,它从已存在进程中创建一个新进程。新进程为子进程,而原进程为父进程。 进程调用fork,当控制转移到内核中的fork代码后,内核将 分配新的内存块和内核数据结构…...
16天自制CppServer-day02
day02-设置错误与异常处理机制 上一天我们写了一个客户端与服务器通过socket进行连接,对socket,bind,listen,accept,connect等函数,我们都设想程序完美地、没有任何异常地运行,但显然这不现实,应该设置出现异常的处理机制&#x…...

时空智友企业流程化管控系统uploadStudioFile接口存在任意文件上传漏洞
免责声明:请勿利用文章内的相关技术从事非法测试,由于传播、利用此文所提供的信息或者工具而造成的任何直接或者间接的后果及损失,均由使用者本人负责,所产生的一切不良后果与文章作者无关。该文章仅供学习用途使用。 1. 时空智友…...

Linux 中文件的权限说明
目录 一:文件权限类型二:默认权限管理1. 查看当前用户的umask值2. 修改当前用户的umask值3. 根据umask计算默认权限 三:普通权限管理1. 三种普通权限说明1.1 对于非目录文件来说1.2 对于目录文件来说 2. 查看某个文件的权限信息2.1 使用 ls -…...

MySql数据库中数据类型
本篇将介绍在 MySql 中的所有数据类型,其中主要分为四类:数值类型、文本和二进制类型、时间日期、String 类型。如下(图片来源:MySQL数据库): 目录如下: 目录 数值类型 1. 整数类型 2. …...

Godot中的信号
目录 概念 signal connect方法连接Callable 信号要求参数 查看信号 连接信号 监听信号 Button - text属性 pressed 连接源 「按钮」的信号连接 使用代码,将方法与信号相连接 节点的connect方法 节点直接使用emit_signal方法通过字符串的方式触发信号…...

突破不可导策略的训练难题:零阶优化与强化学习的深度嵌合
强化学习(Reinforcement Learning, RL)是工业领域智能控制的重要方法。它的基本原理是将最优控制问题建模为马尔可夫决策过程,然后使用强化学习的Actor-Critic机制(中文译作“知行互动”机制),逐步迭代求解…...

Unity3D中Gfx.WaitForPresent优化方案
前言 在Unity中,Gfx.WaitForPresent占用CPU过高通常表示主线程在等待GPU完成渲染(即CPU被阻塞),这表明存在GPU瓶颈或垂直同步/帧率设置问题。以下是系统的优化方案: 对惹,这里有一个游戏开发交流小组&…...

UDP(Echoserver)
网络命令 Ping 命令 检测网络是否连通 使用方法: ping -c 次数 网址ping -c 3 www.baidu.comnetstat 命令 netstat 是一个用来查看网络状态的重要工具. 语法:netstat [选项] 功能:查看网络状态 常用选项: n 拒绝显示别名&#…...

《通信之道——从微积分到 5G》读书总结
第1章 绪 论 1.1 这是一本什么样的书 通信技术,说到底就是数学。 那些最基础、最本质的部分。 1.2 什么是通信 通信 发送方 接收方 承载信息的信号 解调出其中承载的信息 信息在发送方那里被加工成信号(调制) 把信息从信号中抽取出来&am…...
Java 加密常用的各种算法及其选择
在数字化时代,数据安全至关重要,Java 作为广泛应用的编程语言,提供了丰富的加密算法来保障数据的保密性、完整性和真实性。了解这些常用加密算法及其适用场景,有助于开发者在不同的业务需求中做出正确的选择。 一、对称加密算法…...
Matlab | matlab常用命令总结
常用命令 一、 基础操作与环境二、 矩阵与数组操作(核心)三、 绘图与可视化四、 编程与控制流五、 符号计算 (Symbolic Math Toolbox)六、 文件与数据 I/O七、 常用函数类别重要提示这是一份 MATLAB 常用命令和功能的总结,涵盖了基础操作、矩阵运算、绘图、编程和文件处理等…...

零基础设计模式——行为型模式 - 责任链模式
第四部分:行为型模式 - 责任链模式 (Chain of Responsibility Pattern) 欢迎来到行为型模式的学习!行为型模式关注对象之间的职责分配、算法封装和对象间的交互。我们将学习的第一个行为型模式是责任链模式。 核心思想:使多个对象都有机会处…...

UR 协作机器人「三剑客」:精密轻量担当(UR7e)、全能协作主力(UR12e)、重型任务专家(UR15)
UR协作机器人正以其卓越性能在现代制造业自动化中扮演重要角色。UR7e、UR12e和UR15通过创新技术和精准设计满足了不同行业的多样化需求。其中,UR15以其速度、精度及人工智能准备能力成为自动化领域的重要突破。UR7e和UR12e则在负载规格和市场定位上不断优化…...

华硕a豆14 Air香氛版,美学与科技的馨香融合
在快节奏的现代生活中,我们渴望一个能激发创想、愉悦感官的工作与生活伙伴,它不仅是冰冷的科技工具,更能触动我们内心深处的细腻情感。正是在这样的期许下,华硕a豆14 Air香氛版翩然而至,它以一种前所未有的方式&#x…...
CSS设置元素的宽度根据其内容自动调整
width: fit-content 是 CSS 中的一个属性值,用于设置元素的宽度根据其内容自动调整,确保宽度刚好容纳内容而不会超出。 效果对比 默认情况(width: auto): 块级元素(如 <div>)会占满父容器…...