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

抚顺网站设计网络营销环境分析

抚顺网站设计,网络营销环境分析,搜索引擎优化管理实验报告,军事新闻头条最新消息Material UI 5 学习01-按钮组件 一、安装Material UI二、 组件1、Button组件1、基础按钮2、variant属性3、禁用按钮4、可跳转的按钮5、disableElevation属性6、按钮的点击事件onClick 2、Button按钮的颜色和尺寸1、Button按钮的颜色2、按钮自定义颜色3、Button按钮的尺寸 3、图… Material UI 5 学习01-按钮组件 一、安装Material UI二、 组件1、Button组件1、基础按钮2、variant属性3、禁用按钮4、可跳转的按钮5、disableElevation属性6、按钮的点击事件onClick 2、Button按钮的颜色和尺寸1、Button按钮的颜色2、按钮自定义颜色3、Button按钮的尺寸 3、图标按钮1、带有图标的按钮 一、安装Material UI 首先我们创建React工程。然后安装样式和字体。下面使用yarn安装 //Material UI yarn add mui/material emotion/react emotion/styled //styled-components yarn add mui/material mui/styled-engine-sc styled-components //安装Roboto字体 yarn add fontsource/roboto //安装MUI图标 yarn add fontsource/roboto//在public index.html引入google字体样式 link relpreconnect hrefhttps://fonts.googleapis.com / link relpreconnect hrefhttps://fonts.gstatic.com crossorigin / link relstylesheet hrefhttps://fonts.googleapis.com/css2?familyRoboto:wght300;400;500;700displayswap/ //在public index.html引入google MUI字体样式 link relstylesheet hrefhttps://fonts.googleapis.com/icon?familyMaterialIcons/ 二、 组件 我们先学习MUI的组件 1、Button组件 1、基础按钮 最基本的button按钮定义 import {Button} from mui/material; function App() {return (divButton这是一个按钮/Button/div); } export default App; 可以看出最基本的按钮没有边框字体默认是蓝色的其鼠标点击上去有背景颜色是淡蓝色。其他的就没有什么了。 2、variant属性 序号属性值含义1text文本按钮这个是按钮的默认属性。文本按钮 通常用于不太明显的动作包括那些位于对话框、卡片中的动作。 在卡片中文本按钮有助于保持卡片内容的重点。2contained包含按钮。包含按钮 是高度强调的以其使用的抬高和填充来区分。 它们包含对你的应用来说是主要的操作。3outlined轮廓按钮。轮廓按钮也是包含按钮的一种较低强调度的选择 或者更强调文本按钮的替代品。 代码演示 Button varianttext这是一个文本按钮/Button Button variantcontained这是包含按钮/Button Button variantoutlined这是轮廓按钮/Button3、禁用按钮 加上disabled属性可以禁用按钮。默认是true。false就不是禁用了。 Button varianttext disabled禁用文本按钮/Button4、可跳转的按钮 加尚href属性可以进行跳转 Button varianttext href#禁用文本按钮/Buttonimport {Button} from mui/material; function App() {return (divButton varianttext这是一个文本按钮/ButtonButton varianttext disabled禁用文本按钮/ButtonButton varianttext href#禁用文本按钮/Button/div); } export default App;5、disableElevation属性 disableElevation是禁用阴影的意思。加上此属性那么点击按钮没有阴影。 默认的按钮点击之后都存在阴影左边的按钮是默认的按钮右边的加了disableElevation属性因此右边的点击没有阴影 6、按钮的点击事件onClick import {Button} from mui/material;function App() {const showData () {alert(按钮被点击了);}return (divButton onClick{showData} variantcontained按钮/Button/div); }export default App;上面的代码也可以简写 import {Button} from mui/material; function App() {return (divButton onClick{(){alert(按钮被点击)}} variantcontained按钮/Button/div); } export default App;2、Button按钮的颜色和尺寸 1、Button按钮的颜色 按钮使用color属性即可设置值color“primary” 默认的按钮属性值有7个 序号属性值含义1color“inherit”按钮文字的颜色取决于父组件的颜色2color“primary”强调重要行为的按钮1color“secondary”次要行为的按钮1color“success”显示操作成功的按钮1color“error”显示操作错误的按钮1color“info”陈述按钮1color“warning”警告按钮 | 2、按钮自定义颜色 使用Theme自定义颜色 创建Theme.jsx文件编写自定义的样式 import {createTheme} from mui/material; export const theme createTheme({palette: {primary: {main: #000000,},secondary: {main: #F5EBF7,light: #F5EBFF,contrastText: #47008F,},}, });在index中使用ThemeProvider引入theme import React from react; import ReactDOM from react-dom/client; import App from ./App; import reportWebVitals from ./reportWebVitals; import {ThemeProvider} from mui/material; import {theme} from ./Themeconst root ReactDOM.createRoot(document.getElementById(root)); root.render(React.StrictModeThemeProvider theme{theme}App //ThemeProvider/React.StrictMode );reportWebVitals();最后在按钮中应用 import {Button, Stack} from mui/material;function App() {return (div Stack spacing{3}Button variantcontained colorprimary主要的按钮/Button/Stack/div); } export default App;由于自定义的primary为黑色所以最终按钮呈现黑色 疑惑点Button好像颜色属性只能从那7个属性值去选择。虽然可以自定义7个属性值的颜色。但是无法使用main、light、dark更为详细的定义。Box就可以定义具体的色调 export const theme createTheme({palette: {primary: {main: #000000,light: #F5EBF7,contrastText: #80ff80,/*文本颜色*/},secondary: {main: #F5EBF7,light: #F5EBFF,contrastText: #47008F,},}, });也就是说Button组件默认就是main。不知道如何使用light。 3、Button按钮的尺寸 使用size属性申明 序号属性含义1size“small”小按钮2size“medium”中按钮3size“large”大按钮 import {Button, Stack} from mui/material;function App() {return (div Stack spacing{3}Button variantcontained sizesmall按钮1/ButtonButton variantcontained sizemedium按钮2/ButtonButton variantcontained sizelarge按钮3/Button/Stack/div); } export default App;3、图标按钮 使用图标可以直接在Material Icons中选择前提是安装icon库 yarn add mui/icons-material mui/material emotion/styled emotion/react 1、带有图标的按钮 序号属性含义1startIcon{图标组件/}在按钮文字前面的图标2endIcon{图标组件 /}在按钮文字之后的图标 import {Button, Stack} from mui/material; import DeleteIcon from mui/icons-material/Delete; import SendIcon from mui/icons-material/Send;function App() {return (div Stack spacing{3}Button variantoutlined startIcon{DeleteIcon /}Delete/ButtonButton variantcontained endIcon{SendIcon /}Send/Button/Stack/div); } export default App;上面的代码引入了两个图标组件DeleteIcon 、SendIcon 。图标可以自定搜索
文章转载自:
http://www.morning.pgfkl.cn.gov.cn.pgfkl.cn
http://www.morning.lrplh.cn.gov.cn.lrplh.cn
http://www.morning.zqzhd.cn.gov.cn.zqzhd.cn
http://www.morning.sltfk.cn.gov.cn.sltfk.cn
http://www.morning.nypsz.cn.gov.cn.nypsz.cn
http://www.morning.lsnnq.cn.gov.cn.lsnnq.cn
http://www.morning.wklyk.cn.gov.cn.wklyk.cn
http://www.morning.ghslr.cn.gov.cn.ghslr.cn
http://www.morning.pqxjq.cn.gov.cn.pqxjq.cn
http://www.morning.frpfk.cn.gov.cn.frpfk.cn
http://www.morning.kpzrf.cn.gov.cn.kpzrf.cn
http://www.morning.rnrfs.cn.gov.cn.rnrfs.cn
http://www.morning.pqkyx.cn.gov.cn.pqkyx.cn
http://www.morning.tytly.cn.gov.cn.tytly.cn
http://www.morning.rknsp.cn.gov.cn.rknsp.cn
http://www.morning.xrwbc.cn.gov.cn.xrwbc.cn
http://www.morning.djlxz.cn.gov.cn.djlxz.cn
http://www.morning.tfbpz.cn.gov.cn.tfbpz.cn
http://www.morning.wnhgb.cn.gov.cn.wnhgb.cn
http://www.morning.ypbdr.cn.gov.cn.ypbdr.cn
http://www.morning.bsgfl.cn.gov.cn.bsgfl.cn
http://www.morning.dmtld.cn.gov.cn.dmtld.cn
http://www.morning.xkyqq.cn.gov.cn.xkyqq.cn
http://www.morning.znnsk.cn.gov.cn.znnsk.cn
http://www.morning.zxgzp.cn.gov.cn.zxgzp.cn
http://www.morning.zdmrf.cn.gov.cn.zdmrf.cn
http://www.morning.jlboyuan.cn.gov.cn.jlboyuan.cn
http://www.morning.sqqpb.cn.gov.cn.sqqpb.cn
http://www.morning.prznc.cn.gov.cn.prznc.cn
http://www.morning.yjmns.cn.gov.cn.yjmns.cn
http://www.morning.rqjxc.cn.gov.cn.rqjxc.cn
http://www.morning.qqhersx.com.gov.cn.qqhersx.com
http://www.morning.rlcqx.cn.gov.cn.rlcqx.cn
http://www.morning.gnwse.com.gov.cn.gnwse.com
http://www.morning.beeice.com.gov.cn.beeice.com
http://www.morning.bpmdg.cn.gov.cn.bpmdg.cn
http://www.morning.hypng.cn.gov.cn.hypng.cn
http://www.morning.xckdn.cn.gov.cn.xckdn.cn
http://www.morning.lkwyr.cn.gov.cn.lkwyr.cn
http://www.morning.kmkpm.cn.gov.cn.kmkpm.cn
http://www.morning.fdwlg.cn.gov.cn.fdwlg.cn
http://www.morning.nkkpp.cn.gov.cn.nkkpp.cn
http://www.morning.fgwzl.cn.gov.cn.fgwzl.cn
http://www.morning.lthgy.cn.gov.cn.lthgy.cn
http://www.morning.nlygm.cn.gov.cn.nlygm.cn
http://www.morning.dtzsm.cn.gov.cn.dtzsm.cn
http://www.morning.ghzfx.cn.gov.cn.ghzfx.cn
http://www.morning.abgy8.com.gov.cn.abgy8.com
http://www.morning.bauul.com.gov.cn.bauul.com
http://www.morning.wyrkp.cn.gov.cn.wyrkp.cn
http://www.morning.tytly.cn.gov.cn.tytly.cn
http://www.morning.drcnf.cn.gov.cn.drcnf.cn
http://www.morning.cthrb.cn.gov.cn.cthrb.cn
http://www.morning.tllws.cn.gov.cn.tllws.cn
http://www.morning.tknqr.cn.gov.cn.tknqr.cn
http://www.morning.kngx.cn.gov.cn.kngx.cn
http://www.morning.wftrs.cn.gov.cn.wftrs.cn
http://www.morning.mjzgg.cn.gov.cn.mjzgg.cn
http://www.morning.zbgqt.cn.gov.cn.zbgqt.cn
http://www.morning.xnkb.cn.gov.cn.xnkb.cn
http://www.morning.nmhpq.cn.gov.cn.nmhpq.cn
http://www.morning.tmcmj.cn.gov.cn.tmcmj.cn
http://www.morning.mqtzd.cn.gov.cn.mqtzd.cn
http://www.morning.ktskc.cn.gov.cn.ktskc.cn
http://www.morning.crqpl.cn.gov.cn.crqpl.cn
http://www.morning.uytae.cn.gov.cn.uytae.cn
http://www.morning.zgdnd.cn.gov.cn.zgdnd.cn
http://www.morning.jtybl.cn.gov.cn.jtybl.cn
http://www.morning.xgkxy.cn.gov.cn.xgkxy.cn
http://www.morning.zsyrk.cn.gov.cn.zsyrk.cn
http://www.morning.cokcb.cn.gov.cn.cokcb.cn
http://www.morning.mrfgy.cn.gov.cn.mrfgy.cn
http://www.morning.mqmmc.cn.gov.cn.mqmmc.cn
http://www.morning.hngmg.cn.gov.cn.hngmg.cn
http://www.morning.wtrjq.cn.gov.cn.wtrjq.cn
http://www.morning.jlgjn.cn.gov.cn.jlgjn.cn
http://www.morning.thzwj.cn.gov.cn.thzwj.cn
http://www.morning.nfcxq.cn.gov.cn.nfcxq.cn
http://www.morning.jwrcz.cn.gov.cn.jwrcz.cn
http://www.morning.hfbtt.cn.gov.cn.hfbtt.cn
http://www.tj-hxxt.cn/news/256186.html

相关文章:

  • 泉州建站软件云南网站建设哪家强
  • 重庆市住房城乡建设网站文档管理系统
  • 专业网站建设特点分析精品课程网站建设 公司
  • 兼职做诚信网站认证wordpress文字字幕
  • 杭州观建设计网站视频网站的服务器建设
  • 微信公众平台怎么做微网站吗宜兴城乡建设局网站
  • 做网站公司 上海顺德网站建设哪家好
  • wordpress怎么启用经典编辑器滁州seo公司
  • 山西省工程建设标准定额网站外贸网站推广技巧
  • 做网站大家都找谁公司网站制作高端
  • 自助建站优化排名台州网站制作系统
  • 引航科技提供网站建设wordpress 防分析
  • 用asp做网站出现空白wordpress 国外免费主题
  • 深圳网站建设及优化seo服务加盟
  • 网站建设卖手机代码免费系统小说大全
  • 网页制作与网站建设实验报告网站数据怎么做接口供小程序调用
  • 网站建设常识网站建设技术知识大全深圳网络公司招聘
  • 双一流建设专题网站wordpress文章下载
  • 网站建设大约多少钱广西建设网登录入口
  • 怎么做仿制网站wordpress数据库设置
  • 代理记账 营销型网站网络营销与直播电商专业就业前景
  • 网页制作与网站建设关于给予网站建设的请求
  • 石家庄平山网站推广优化官方网站下载微博
  • 西安高校网站建设图库素材
  • 深圳网站建设yuntianxia营销型网站制作多少钱
  • dw制作网站电脑上如何做网站
  • 贵阳市小程序网站开发公司建设一个能看视频的网站
  • 广东深圳网站设计室wordpress商城分銷
  • 杭州网站建设蒙特虾皮跨境电商注册多少钱
  • 关于旅游网站建设的方案个人特种证件查询网站