From ddfca5b3c7183c3796b6407cbcf14da59f05bfa0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=B0=B1=E7=9C=A0=E4=BB=AA=E5=BC=8F?= <854085467@qq.com>
Date: Fri, 1 Oct 2021 20:22:49 +0800
Subject: [PATCH] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=20avatar=20=E5=A4=B4?=
=?UTF-8?q?=E5=83=8F=E7=BB=84=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/docs/zh-CN/components/avatar.md | 77 ++++++++++++++++++++++++++++
docs/src/layouts/Layout.vue | 1 +
docs/src/router/zh-CN.ts | 5 ++
docs/src/styles/markdown.css | 4 ++
src/css/layui-vue.css | 42 +++++++++++++++
src/index.ts | 6 ++-
src/module/avatar/index.ts | 9 ++++
src/module/avatar/index.vue | 14 +++++
src/module/badge/index.vue | 29 ++++++-----
9 files changed, 172 insertions(+), 15 deletions(-)
create mode 100644 docs/docs/zh-CN/components/avatar.md
create mode 100644 src/css/layui-vue.css
create mode 100644 src/module/avatar/index.ts
create mode 100644 src/module/avatar/index.vue
diff --git a/docs/docs/zh-CN/components/avatar.md b/docs/docs/zh-CN/components/avatar.md
new file mode 100644
index 00000000..22c3866c
--- /dev/null
+++ b/docs/docs/zh-CN/components/avatar.md
@@ -0,0 +1,77 @@
+::: demo
+
+
+
+
+
+
+
+:::
+
+::: demo
+
+
+
+
+
+
+
+:::
+
+::: demo
+
+
+
+
+
+
+
+
+
+:::
+
+| | | |
+|--|--|--|
+| src | 图源 | -- |
+| size | 尺寸 | `xs` `sm` `lg`|
+| radius | 圆形 | `true` `false`|
\ No newline at end of file
diff --git a/docs/src/layouts/Layout.vue b/docs/src/layouts/Layout.vue
index f3dc6a52..3767958b 100644
--- a/docs/src/layouts/Layout.vue
+++ b/docs/src/layouts/Layout.vue
@@ -81,6 +81,7 @@ export default {
{ id: 20, title: '颜色',subTitle:"color" ,path: '/zh-CN/components/color' },
{ id: 21, title: '手风琴',subTitle:"collapse" ,path: '/zh-CN/components/collapse' },
{ id: 22, title: '表格',subTitle:"table" ,path: '/zh-CN/components/table' },
+ { id: 23, title: '头像',subTitle:"avatar" ,path: '/zh-CN/components/avatar' },
]
const selected = ref(1)
diff --git a/docs/src/router/zh-CN.ts b/docs/src/router/zh-CN.ts
index 2557154f..481d45b7 100644
--- a/docs/src/router/zh-CN.ts
+++ b/docs/src/router/zh-CN.ts
@@ -116,6 +116,11 @@ const zhCN = [
path: '/zh-CN/components/table',
component: () => import('../../docs/zh-CN/components/table.md'),
meta: { title: '表格' },
+ },
+ {
+ path: '/zh-CN/components/avatar',
+ component: () => import('../../docs/zh-CN/components/avatar.md'),
+ meta: { title: '头像' },
}
],
},
diff --git a/docs/src/styles/markdown.css b/docs/src/styles/markdown.css
index 69b43805..442d09a7 100644
--- a/docs/src/styles/markdown.css
+++ b/docs/src/styles/markdown.css
@@ -175,3 +175,7 @@ table th {
table td {
white-space: nowrap;
}
+
+.source .layui-avatar {
+ margin-right: 30px;
+}
\ No newline at end of file
diff --git a/src/css/layui-vue.css b/src/css/layui-vue.css
new file mode 100644
index 00000000..8c7ba4a3
--- /dev/null
+++ b/src/css/layui-vue.css
@@ -0,0 +1,42 @@
+.layui-avatar {
+ box-sizing: border-box;
+ margin: 0;
+ padding: 0;
+ color: #000000d9;
+ font-size: 14px;
+ font-variant: tabular-nums;
+ line-height: 1.5715;
+ list-style: none;
+ font-feature-settings: tnum;
+ position: relative;
+ display: inline-block;
+ overflow: hidden;
+ color: #fff;
+ white-space: nowrap;
+ text-align: center;
+ vertical-align: middle;
+ background: #ccc;
+ width: 32px;
+ height: 32px;
+ line-height: 32px;
+ border-radius: 4px;
+}
+
+.layui-avatar.layui-avatar-radius {
+ border-radius: 50%;
+}
+
+.layui-avatar.layui-avatar-sm {
+ height: 30px;
+ width: 30px;
+}
+
+.layui-avatar.layui-avatar-lg {
+ height: 36px;
+ width: 36px;
+}
+
+.layui-avatar.layui-avatar-xs {
+ height: 28px;
+ width: 28px;
+}
\ No newline at end of file
diff --git a/src/index.ts b/src/index.ts
index fa926c44..c49e5f20 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -2,6 +2,8 @@ import type { App } from 'vue'
import type { IDefineComponent, InstallOptions } from './module/type/index'
import "./css/layui.css"
+import "./css/layui-vue.css"
+import LayAvatar from './module/avatar/index'
import LayRadio from './module/radio/index'
import LayButton from './module/button/index'
import LayButtonContainer from './module/buttonContainer/index'
@@ -71,7 +73,8 @@ const components: Record = {
LayCheckbox,
LayForm,
LayBreadcrumb,
- LayBreadcrumbItem
+ LayBreadcrumbItem,
+ LayAvatar
}
const install = (app: App, options?: InstallOptions): void => {
@@ -119,6 +122,7 @@ export {
LayForm,
LayBreadcrumb,
LayBreadcrumbItem,
+ LayAvatar,
install,
}
diff --git a/src/module/avatar/index.ts b/src/module/avatar/index.ts
new file mode 100644
index 00000000..f9154769
--- /dev/null
+++ b/src/module/avatar/index.ts
@@ -0,0 +1,9 @@
+import type { App } from 'vue'
+import Component from './index.vue'
+import type { IDefineComponent } from '../type/index'
+
+Component.install = (app: App) => {
+ app.component(Component.name || 'LayAvatar', Component)
+}
+
+export default Component as IDefineComponent
diff --git a/src/module/avatar/index.vue b/src/module/avatar/index.vue
new file mode 100644
index 00000000..16f15432
--- /dev/null
+++ b/src/module/avatar/index.vue
@@ -0,0 +1,14 @@
+
+
+
+
+
diff --git a/src/module/badge/index.vue b/src/module/badge/index.vue
index a74636da..768e3499 100644
--- a/src/module/badge/index.vue
+++ b/src/module/badge/index.vue
@@ -1,7 +1,7 @@
-
-
-
+
+
+
\ No newline at end of file