首页 分享 组件Element的入门学习

组件Element的入门学习

来源:花匠小妙招 时间:2024-12-14 17:56
组件Element的入门学习 第一节:Layout布局

基础默认一行24列,通过自己简单的布局可以实现想要的效果 1 基础布局

注意;通过 row 和 col 组件,并通过 col 组件的 span 属性就可以实现我们简单的布局。
1.默认一列24行

<el-row> <el-col :span="24"><div class="grid-content bg-purple-dark"></div></el-col> </el-row> 123

2.以12个为一组

<el-row> <el-col :span="12"><div class="grid-content bg-purple"></div></el-col> <el-col :span="12"><div class="grid-content bg-purple-light"></div></el-col> </el-row> 1234

3.以8-8-8分组

<el-row> <el-col :span="8"><div class="grid-content bg-purple"></div></el-col> <el-col :span="8"><div class="grid-content bg-purple-light"></div></el-col> <el-col :span="8"><div class="grid-content bg-purple"></div></el-col> </el-row> 12345

显示效果如下:
在这里插入图片描述

分栏间隔

在这里插入图片描述
Row 组件 提供 gutter 属性来指定每一栏之间的间隔,默认间隔为 0。

<el-row :gutter="20"> <el-col :span="6"><div class="grid-content bg-purple"></div></el-col> <el-col :span="6"><div class="grid-content bg-purple"></div></el-col> <el-col :span="6"><div class="grid-content bg-purple"></div></el-col> <el-col :span="6"><div class="grid-content bg-purple"></div></el-col> </el-row> 123456 混合布局

在这里插入图片描述

<el-row :gutter="20"> <el-col :span="16"><div class="grid-content bg-purple"></div></el-col> <el-col :span="8"><div class="grid-content bg-purple"></div></el-col> </el-row> <el-row :gutter="20"> <el-col :span="8"><div class="grid-content bg-purple"></div></el-col> <el-col :span="8"><div class="grid-content bg-purple"></div></el-col> <el-col :span="4"><div class="grid-content bg-purple"></div></el-col> <el-col :span="4"><div class="grid-content bg-purple"></div></el-col> </el-row> 12345678910 分栏偏移

在这里插入图片描述

<el-row :gutter="20"> <el-col :span="6"><div class="grid-content bg-purple"></div></el-col> <el-col :span="6" :offset="6"><div class="grid-content bg-purple"></div></el-col> </el-row> <el-row :gutter="20"> <el-col :span="6" :offset="6"><div class="grid-content bg-purple"></div></el-col> <el-col :span="6" :offset="6"><div class="grid-content bg-purple"></div></el-col> </el-row> <el-row :gutter="20"> <el-col :span="12" :offset="6"><div class="grid-content bg-purple"></div></el-col> </el-row> 1234567891011 对齐方式

在这里插入图片描述
将 type 属性赋值为 ‘flex’,可以启用 flex 布局,并可通过 justify 属性来指定 start, center, end, space-between, space-around 其中的值来定义子元素的排版方式。

<el-row type="flex" class="row-bg"> <el-col :span="6"><div class="grid-content bg-purple"></div></el-col> <el-col :span="6"><div class="grid-content bg-purple-light"></div></el-col> <el-col :span="6"><div class="grid-content bg-purple"></div></el-col> </el-row> <el-row type="flex" class="row-bg" justify="center"> <el-col :span="6"><div class="grid-content bg-purple"></div></el-col> <el-col :span="6"><div class="grid-content bg-purple-light"></div></el-col> <el-col :span="6"><div class="grid-content bg-purple"></div></el-col> </el-row> <el-row type="flex" class="row-bg" justify="end"> <el-col :span="6"><div class="grid-content bg-purple"></div></el-col> <el-col :span="6"><div class="grid-content bg-purple-light"></div></el-col> <el-col :span="6"><div class="grid-content bg-purple"></div></el-col> </el-row> <el-row type="flex" class="row-bg" justify="space-between"> <el-col :span="6"><div class="grid-content bg-purple"></div></el-col> <el-col :span="6"><div class="grid-content bg-purple-light"></div></el-col> <el-col :span="6"><div class="grid-content bg-purple"></div></el-col> </el-row> <el-row type="flex" class="row-bg" justify="space-around"> <el-col :span="6"><div class="grid-content bg-purple"></div></el-col> <el-col :span="6"><div class="grid-content bg-purple-light"></div></el-col> <el-col :span="6"><div class="grid-content bg-purple"></div></el-col> </el-row>

12345678910111213141516171819202122232425 响应式布局

根据 Bootstrap 的 响应式设计,预设了五个响应尺寸:xs、sm、md、lg 和 xl。
在这里插入图片描述

<el-row :gutter="10"> <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="1"><div class="grid-content bg-purple"></div></el-col> <el-col :xs="4" :sm="6" :md="8" :lg="9" :xl="11"><div class="grid-content bg-purple-light"></div></el-col> <el-col :xs="4" :sm="6" :md="8" :lg="9" :xl="11"><div class="grid-content bg-purple"></div></el-col> <el-col :xs="8" :sm="6" :md="4" :lg="3" :xl="1"><div class="grid-content bg-purple-light"></div></el-col> </el-row> 123456 基于断点的隐藏类

Element 额外提供了一系列类名,用于在某些条件下隐藏元素。这些类名可以添加在任何 DOM 元素或自定义组件上。如果需要,请自行引入以下文件:

import 'element-ui/lib/theme-chalk/display.css'; 1

包含的类名及其含义为:

hidden-xs-only - 当视口在 xs 尺寸时隐藏hidden-sm-only - 当视口在 sm 尺寸时隐藏hidden-sm-and-down - 当视口在 sm 及以下尺寸时隐藏hidden-sm-and-up - 当视口在 sm 及以上尺寸时隐藏hidden-md-only - 当视口在 md 尺寸时隐藏hidden-md-and-down - 当视口在 md 及以下尺寸时隐藏hidden-md-and-up - 当视口在 md 及以上尺寸时隐藏hidden-lg-only - 当视口在 lg 尺寸时隐藏hidden-lg-and-down - 当视口在 lg 及以下尺寸时隐藏hidden-lg-and-up - 当视口在 lg 及以上尺寸时隐藏hidden-xl-only - 当视口在 xl 尺寸时隐藏 Row 属性 参数说明类型可选值默认值gutte栅格间隔number—0type布局模式,可选 flex,现代浏览器下有效string——justifyflex 布局下的水平排列方式stringstart/end/center/space-around/space-betweenstartalignflex 布局下的垂直排列方式stringtop/middle/bottomtoptag自定义元素标签*—div Col属性 参数说明类型可选值默认值span栅格占据的列数number—24offset栅格左侧的间隔格数number—0push栅格向右移动格数number—0pull栅格向左移动格数number—0xs<768px 响应式栅格数或者栅格属性对象number/object (例如: {span: 4, offset: 4})——sm≥768px 响应式栅格数或者栅格属性对象number/object (例如: {span: 4, offset: 4})——md≥992px 响应式栅格数或者栅格属性对象number/object (例如: {span: 4, offset: 4})——lg≥1200px 响应式栅格数或者栅格属性对象number/object (例如: {span: 4, offset: 4})——xl≥1920px 响应式栅格数或者栅格属性对象number/object (例如: {span: 4, offset: 4})——tag自定义元素标签string*div

相关知识

【Vue 快速入门】从零开始搭建 VUE + Element UI后台管理系统框架
使用Jasmine在Angular中测试组件:第1部分
Vue.js 增删查改库存管理系统教程:新手友好的完整代码与详细步骤」 「从零开始的库存管理系统:Vue.js 实现搜索、编辑、删除与数据更新」 「超详细的 Vue.js CRUD 教程:带你一步步构
layui 教程 => 干货
插花花艺学习的入门技巧
花卉设计元素(Floral Design Element)
草图大师的组件
适合新手学习花艺的几种入门方法
超详细的网页设计学习指南,零基础入门必看!
uniapp+vue3+云开发全栈开发同城配送鲜花小程序任意商城基础入门到实战

网址: 组件Element的入门学习 https://www.huajiangbk.com/newsview1094987.html

所属分类:花卉
上一篇: 月季花什么季节移栽
下一篇: 鸡蛋花什么季节开

推荐分享