Skip to content

Commit

Permalink
feat: 🎸 v0.0.4发布
Browse files Browse the repository at this point in the history
  • Loading branch information
kailong321200875 committed Jan 26, 2021
1 parent 85555ee commit a58dc1b
Show file tree
Hide file tree
Showing 38 changed files with 675 additions and 146 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

- 多页配置

- 引导页

- 全局功能
- 三种不同风格 layout 布局
- 动态侧边栏(支持多级路由嵌套)
Expand All @@ -42,6 +44,9 @@
- 弹窗
- 显示更多
- 详情组件
- 二维码组件
- 头像组
- 文字高亮

- 表格
- 基础表格
Expand Down
18 changes: 17 additions & 1 deletion mock/role/admin-role.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ export const checkedNodes = [{
'path': '/components-demo/qrcode',
'title': '二维码组件',
'name': 'QrcodeDemo'
}, {
'path': '/components-demo/avatars',
'title': '头像组',
'name': 'AvatarsDemo'
}, {
'path': '/components-demo/highlight',
'title': '文字高亮',
'name': 'HighlightDemo'
}]
}, {
'path': '/components-demo/echarts',
Expand Down Expand Up @@ -99,6 +107,14 @@ export const checkedNodes = [{
'path': '/components-demo/qrcode',
'title': '二维码组件',
'name': 'QrcodeDemo'
}, {
'path': '/components-demo/avatars',
'title': '头像组',
'name': 'AvatarsDemo'
}, {
'path': '/components-demo/highlight',
'title': '文字高亮',
'name': 'HighlightDemo'
}, {
'path': '/table-demo',
'title': '表格',
Expand Down Expand Up @@ -415,7 +431,7 @@ export const checkedNodes = [{
export const checkedkeys = ['/components-demo', '/components-demo/echarts', '/components-demo/preview',
'/components-demo/button', '/components-demo/message', '/components-demo/count-to', '/components-demo/search',
'/components-demo/editor', '/components-demo/markdown', '/components-demo/dialog', '/components-demo/more',
'/components-demo/detail', '/components-demo/qrcode', '/table-demo', '/table-demo/basic-table', '/table-demo/page-table',
'/components-demo/detail', '/components-demo/qrcode', '/components-demo/avatars', '/table-demo', '/table-demo/basic-table', '/table-demo/page-table',
'/table-demo/stripe-table', '/table-demo/border-table', '/table-demo/state-table', '/table-demo/fixed-header',
'/table-demo/fixed-column', '/table-demo/fixed-column-header', '/table-demo/fluid-height',
'/table-demo/multi-header', '/table-demo/single-choice', '/table-demo/multiple-choice', '/table-demo/sort-table',
Expand Down
16 changes: 16 additions & 0 deletions mock/role/test-role.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,22 @@ export const checkedRoleNodes = [
meta: {
title: '二维码组件'
}
},
{
path: 'avatars',
component: 'pages/index/views/components-demo/avatars/index',
name: 'AvatarsDemo',
meta: {
title: '头像组'
}
},
{
path: 'highlight',
component: 'pages/index/views/components-demo/highlight/index',
name: 'HighlightDemo',
meta: {
title: '文字高亮'
}
}
]
},
Expand Down
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-element-plus-admin-webpack",
"version": "0.1.0",
"version": "0.0.4",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand All @@ -20,8 +20,9 @@
"clipboard": "^2.0.6",
"core-js": "^3.6.5",
"echarts": "^4.9.0",
"element-plus": "1.0.1-beta.26",
"element-plus": "1.0.2-beta.29",
"highlight.js": "^10.4.0",
"intro.js": "^3.2.1",
"lodash-es": "^4.17.15",
"mitt": "^2.1.0",
"mockjs": "^1.1.0",
Expand All @@ -32,8 +33,8 @@
"qs": "^6.9.4",
"screenfull": "^5.0.2",
"vditor": "^3.7.0",
"vue": "3.0.4",
"vue-router": "4.0.0-rc.6",
"vue": "3.0.5",
"vue-router": "4.0.3",
"vuex": "4.0.0-rc.2",
"wangeditor": "4.5.4",
"web-storage-cache": "^1.1.1"
Expand All @@ -44,6 +45,7 @@
"@ls-lint/ls-lint": "^1.9.2",
"@types/clipboard": "^2.0.1",
"@types/echarts": "^4.9.1",
"@types/intro.js": "^3.0.0",
"@types/lodash-es": "^4.17.3",
"@types/mockjs": "^1.0.3",
"@types/nprogress": "^0.2.0",
Expand Down Expand Up @@ -71,7 +73,7 @@
"eslint-config-prettier": "^6.14.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-vue": "^7.0.0-0",
"husky": "^1.3.1",
"husky": "1.3.1",
"less": "^3.0.4",
"less-loader": "^5.0.0",
"path": "^0.12.7",
Expand Down
133 changes: 133 additions & 0 deletions src/components/Avatars/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<template>
<div class="avatars-wrap">
<template v-if="tooltip">
<el-tooltip
v-for="(item, $index) in avatarsData"
:key="$index"
:content="item.text"
effect="dark"
placement="top"
>
<div :class="showAvatar ? 'avatars-item-img' : ['avatars-item', `avatars-${item.type || 'default'}`]">
<el-avatar v-if="showAvatar" :size="40" :src="item.url">
<img :src="require('@/assets/img/avatar.png')">
</el-avatar>
<span v-else>{{ item.text.substr(0, 1) }}</span>
</div>
</el-tooltip>
<div v-if="max && data.length - max > 0" :class="['avatars-item', 'avatars-item-img']">
<span>+{{ data.length - max }}</span>
</div>
</template>
<template v-else>
<div
v-for="(item, $index) in avatarsData"
:key="$index"
:class="showAvatar ? 'avatars-item-img' : ['avatars-item', `avatars-${item.type || 'default'}`]"
>
<el-avatar v-if="showAvatar" :size="40" :src="item.url">
<img :src="require('@/assets/img/avatar.png')">
</el-avatar>
<span v-else>{{ item.text.substr(0, 1) }}</span>
</div>
<div v-if="max && data.length - max > 0" :class="['avatars-item', 'avatars-item-img']">
<span>+{{ data.length - max }}</span>
</div>
</template>
</div>
</template>

<script lang="ts">
import { defineComponent, PropType, computed } from 'vue'
import { deepClone } from '@/utils'
import { DataConfig } from './types'
export default defineComponent({
name: 'Avatars',
props: {
// 展示的数据
data: {
type: Array as PropType<DataConfig[]>,
default: () => []
},
// 最大展示数量
max: {
type: Number as PropType<number>,
default: 0
},
// 是否使用头像
showAvatar: {
type: Boolean as PropType<boolean>,
default: false
},
// 是否显示完整名称
tooltip: {
type: Boolean as PropType<boolean>,
default: true
}
},
setup(props) {
const avatarsData = computed(() => {
if (props.max) {
if (props.data.length <= props.max) {
return props.data
} else {
const data = deepClone(props.data).splice(0, props.max)
return data
}
} else {
return props.data
}
})
return {
avatarsData
}
}
})
</script>

<style lang="less" scoped>
.avatars-wrap {
display: flex;
.avatars-item {
display: inline-block;
width: 40px;
height: 40px;
line-height: 40px;
border-radius: 50%;
border: 1px solid #fff;
text-align: center;
color: #fff;
background: #2d8cf0;
}
.avatars-item-img {
display: inline-block;
border-radius: 50%;
.el-avatar--circle {
border: 1px solid #fff;
}
}
.avatars-item-img + .avatars-item-img {
margin-left: -12px;
}
.avatars-item + .avatars-item {
margin-left: -12px;
}
.avatars-default {
color: #bae7ff;
background: #096dd9;
}
.avatars-success {
color: #f6ffed;
background: #52c41a;
}
.avatars-danger {
color: #fff1f0;
background: #f5222d;
}
.avatars-warning {
color: #fffbe6;
background: #faad14;
}
}
</style>
5 changes: 5 additions & 0 deletions src/components/Avatars/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export interface DataConfig {
text: string
type?: string
url?: string
}
5 changes: 4 additions & 1 deletion src/components/Detail/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class="detail__content"
:style="contentStyleObj"
>
<el-row>
<el-row type="flex">
<el-col
v-for="(item, $index) in schema"
:key="$index"
Expand Down Expand Up @@ -192,6 +192,9 @@ export default defineComponent({
}
}
.detail__content {
@{deep}(.el-row) {
flex-wrap: wrap;
}
.detail__content--flex {
display: flex;
height: 100%;
Expand Down
69 changes: 69 additions & 0 deletions src/components/Highlight/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<script lang="ts">
import { defineComponent, PropType, computed, h } from 'vue'
export default defineComponent({
name: 'Highlight',
props: {
tag: {
type: String as PropType<string>,
default: 'span'
},
keys: {
type: Array as PropType<string[]>,
default: () => []
},
color: {
type: String as PropType<string>,
default: '#2d8cf0'
}
},
emits: ['click'],
setup(props, { emit }) {
const keyNodes = computed(() => {
return props.keys.map(key => {
return h('span', {
onClick: () => {
emit('click', key)
},
style: {
color: props.color,
cursor: 'pointer'
}
}, key)
})
})
function parseText(text: string) {
props.keys.forEach((key, index) => {
const regexp = new RegExp(key, 'g')
text = text.replace(regexp, `{{${index}}}`)
})
return text.split(/{{|}}/)
}
return {
keyNodes,
parseText
}
},
render(props: any) {
if (!props.$slots.default) return null
const node = props.$slots.default()[0].children
if (!node) {
console.warn('Highlight组件的插槽必须要是文本')
return props.$slots.default()[0]
}
const textArray = props.parseText(node)
const regexp = /^[0-9]*$/
const nodes = textArray.map((t: any) => {
if (regexp.test(t)) {
return props.keyNodes[Math.floor(t)] || t
}
return t
})
return h(props.tag, nodes)
}
})
</script>

<style>
</style>
2 changes: 1 addition & 1 deletion src/components/Logo/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<script lang="ts">
import { defineComponent, ref, watch, PropType, computed } from 'vue'
import { appStore } from '_p/index/store/modules/app'
import { appStore } from '_@/store/modules/app'
export default defineComponent({
name: 'Logo',
Expand Down
2 changes: 1 addition & 1 deletion src/components/ParentView/useCache.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { computed, ref, unref, ComponentInternalInstance, getCurrentInstance } from 'vue'

import { tagsViewStore, PAGE_LAYOUT_KEY } from '_p/index/store/modules/tagsView'
import { tagsViewStore, PAGE_LAYOUT_KEY } from '_@/store/modules/tagsView'

import { useRouter } from 'vue-router'

Expand Down
2 changes: 1 addition & 1 deletion src/components/Screenfull/index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<el-tooltip placement="bottom" :content="isFullscreen ? '退出全屏' : '全屏'">
<div style="height: 100%;" class="screenfull-svg" @click="click">
<div id="screenfull-container" style="height: 100%;" class="screenfull-svg" @click="click">
<svg-icon :icon-class="isFullscreen?'exit-fullscreen':'fullscreen'" />
</div>
</el-tooltip>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Setting/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@

<script lang="ts">
import { defineComponent, computed, ref } from 'vue'
import { appStore } from '_p/index/store/modules/app'
import { appStore } from '_@/store/modules/app'
export default defineComponent({
name: 'Setting',
setup() {
Expand Down
Loading

0 comments on commit a58dc1b

Please sign in to comment.