Material-UI使用

发布时间:2026/9/19 8:55:43

Material-UI使用 1、安装npm install mui/material emotion/react emotion/styled npm install mui/x-data-grid2、表格使用DataGrid组件时其模型中需要有属性id有CheckBox时使用onSelectionModelChange方法来监听选择的变化。返回的新选择模式是属性id3、时间轴组件需要安装mui/labnpm install mui/lab4、MUI System(v9.2)4.1 styled方法输入为tag, inputOptions {}taginputOptions输出为函数muiStyledResolver其输入为expressionsInput返回值为Componentconst muiStyledResolver (...expressionsInput) { const expressionsHead []; const expressionsBody expressionsInput.map(transformStyle); const expressionsTail []; // Preprocess props to set the scoped theme value. // This must run before any other expression. expressionsHead.push(styleAttachTheme); if (componentName overridesResolver) { expressionsTail.push(function styleThemeOverrides(props) { const theme props.theme; const styleOverrides theme.components?.[componentName]?.styleOverrides; if (!styleOverrides) { return null; } const resolvedStyleOverrides {}; // TODO: v7 remove iteration and use resolveStyleArg(styleOverrides[slot]) directly // eslint-disable-next-line guard-for-in for (const slotKey in styleOverrides) { resolvedStyleOverrides[slotKey] processStyle( props, styleOverrides[slotKey], props.theme.modularCssLayers ? theme : undefined, ); } return overridesResolver(props, resolvedStyleOverrides); }); } if (componentName !skipVariantsResolver) { expressionsTail.push(function styleThemeVariants(props) { const theme props.theme; const themeVariants theme?.components?.[componentName]?.variants; if (!themeVariants) { return null; } return processStyleVariants( props, themeVariants, [], props.theme.modularCssLayers ? theme : undefined, ); }); } if (!skipSx) { expressionsTail.push(styleFunctionSx); } // This function can be called as a tagged template, so the first argument would contain // CSS string[] values. if (Array.isArray(expressionsBody[0])) { const inputStrings expressionsBody.shift(); // We need to add placeholders in the tagged template for the custom functions we have // possibly added (attachTheme, overrides, variants, and sx). const placeholdersHead new Array(expressionsHead.length).fill(); const placeholdersTail new Array(expressionsTail.length).fill(); let outputStrings; // prettier-ignore { outputStrings [...placeholdersHead, ...inputStrings, ...placeholdersTail]; outputStrings.raw [...placeholdersHead, ...inputStrings.raw, ...placeholdersTail]; } // The only case where we put something before attachTheme expressionsHead.unshift(outputStrings); } const expressions [...expressionsHead, ...expressionsBody, ...expressionsTail]; const Component defaultStyledResolver(...expressions); if (tag.muiName) { Component.muiName tag.muiName; } if (process.env.NODE_ENV ! production) { Component.displayName generateDisplayName(componentName, componentSlot, tag); } return Component; };5、组件(v4)5.1 Card卡片集成内容和操作CardContentCardActions参考资料安装 - MUIGitHub - mui-org/material-ui at v5.1.0
延伸阅读

更多相关文章

2026/9/19 8:55:17

Unity-Weld MVVM框架:数据绑定与UI开发效率提升实践

1. 项目概述:为什么Unity-Weld值得你花时间研究? 如果你正在用Unity做UI,尤其是那种数据驱动、需要频繁更新的界面,比如一个实时显示玩家状态的HUD、一个动态刷新的背包列表,或者一个复杂的设置面板,那你大…

2026/9/16 17:38:14

从Unix Pipe到Go Channel:深入解析管道模式在并发与系统设计中的应用

1. 从“管道”到“管道”:一个后端工程师的PIPE学习心路 最近在梳理一个老项目的日志处理模块时,遇到了一个典型的性能瓶颈:主业务线程需要将大量实时生成的日志条目,异步地、可靠地写入到远端的日志分析服务。最初的实现简单粗暴…

2026/9/18 3:17:08

基于LangGraph 搭建的 Agent 架构图

一个完整的 Agent,到底是怎么运行的? 这张图梳理了基于 LangGraph 搭建 Agent 的核心流程:从用户任务输入、State 状态初始化,到大模型理解任务、调用工具、处理结果、条件判断,再到最终输出。 同时还包含记忆管理、知…

2026/9/19 8:54:00

浏览器扩展加载机制与三大浏览器安装管理指南

1. 浏览器扩展的加载机制与"绕过付费"的真实含义先把一个容易混淆的概念说清楚。标题里提到的"绕过付费",在浏览器扩展这个圈子里,指的从来不是破解、盗版或者攻击服务器那一套东西。它真正指向的是一类叫bypass paywalls的扩展工具…

2026/9/19 8:54:00

Flutter MySQL鸿蒙适配:性能优化与实战指南

1. 项目背景与核心价值在移动应用开发领域,Flutter因其跨平台特性已成为主流选择之一。而galileo_mysql作为Flutter生态中优秀的MySQL客户端库,其性能与功能一直备受开发者青睐。但随着鸿蒙系统的崛起,许多Flutter应用需要适配这一新兴操作系…

2026/9/19 8:54:00

YOLOv5s+BIFPN隧道裂缝检测:从数据集到边缘部署实战

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

2026/9/19 8:49:00

DBeaver连接IoTDB的JDBC驱动配置全指南

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

2026/9/18 14:13:01

拯救者Y7000黑屏故障排查与维修实战指南

1. 项目概述:一台黑屏的拯救者Y7000,到底卡在哪一步? 联想拯救者Y7000系列笔记本,从2018年第一代搭载i5-8300H开始,到后来的i7-9750H、i7-10750H、i5-11400H,再到2023年款的R7-7840HS,它始终是学…

2026/9/19 0:03:10

验证 OpenSpec 兼容性,Cursor 的 Token 从 TaoToken 出

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

2026/9/19 0:03:10

书桌角落的 Mac mini,OpenClaw 通过 TaoToken 跑任务。

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

2026/9/19 0:03:10

oh-my-hermes:打造跨工具的命令编排与插件化工作流

1. 项目概述与设计初衷1.1 它到底是什么先说结论:oh-my-hermes 是一个面向开发者日常终端操作的效率工具套件,核心定位是“把分散在各类命令行工具里的高频操作,统一收拢成一套插件化、可编排的工作流”。项目灵感来源很明显——oh-my-zsh 重…

2026/9/18 14:13:03

USB Type-C PCB布局分区设计:电源、高速信号与PD协议全攻略

做硬件这行,Type-C接口算是典型的“看着简单,做起来全坑”的东西。光引脚就24个,高低速信号、电源、控制线全部塞在一个小小的连接器里,如果PCB布局不做规划,打样回来基本就是“插上没反应”、“高速掉线”、“静电一打…

2026/9/18 14:13:02

系统编程学习原型如何补齐稳定性边界

系统编程学习原型如何补齐稳定性边界预算有限时&#xff0c;我先优化明显多余的复制&#xff0c;而不是猜测性地换容器。用借用传递只读数据通常就能减少分配&#xff1a; fn parse(line: &str) -> Result<Item, Error> { /* ... */ }用基准确认热点确实在分配&am…

2026/9/18 14:13:02

雨花区哪家财务公司代理记账比较好?

在雨花区&#xff0c;企业处理财税事务常常面临诸多挑战&#xff0c;选择一家靠谱的财务公司至关重要。湖南巨勤财务管理咨询有限公司就是本地正规实体财税服务机构&#xff0c;深耕本地工商财税行业多年&#xff0c;熟悉当地工商局、税务局最新政策与申报流程。主营公司注册、…

还想了解更多?直接咨询顾问

免费诊断 + 免费方案 + 透明报价。

全国咨询热线400-8866-253
免费获取方案
咨询二维码