Commit 9acc6e01 by 匡雅琴

Merge branch 'dev_v1.0.0' into kyq-province

2 parents af5163b2 098df0d7
Showing 79 changed files with 1312 additions and 253 deletions
{ {
"include": [ "include": [
"./src/packages/**/*.vue" "./src/packages/**/*.vue",
"./src/bcPackages/**/*.vue"
], ],
"title": "组件文档", "title": "组件文档",
"genType": "docute" "genType": "docute"
......
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
...@@ -21,46 +21,61 @@ ...@@ -21,46 +21,61 @@
new Docute({ new Docute({
target: '#docute', target: '#docute',
sidebar: [{ sidebar: [{
title: '组件文档', title: '基础组件',
links: [ links: [{
{ title: 'Blog',
title: 'Blog', link: '/components/Blog'
link: '/components/Blog' },
}, {
{ title: 'TestComp',
title: 'TestComp', link: '/components/TestComp'
link: '/components/TestComp' },
}, {
{ title: 'GLButton',
title: 'GLTable', link: '/components/GLButton'
link: '/components/GLTable' },
}, {
{ title: 'GLTable',
title: 'Popover(el)-气泡框', link: '/components/GLTable'
link: '/components/Popover' },
}, {
{ title: 'Popover(el)-气泡框',
title: 'GLSearchItem', link: '/components/Popover'
link: '/components/GLSearchItem' },
}, {
{ title: 'GLSearchItem',
title: 'GLSearch', link: '/components/GLSearchItem'
link: '/components/GLSearch' },
}, {
{ title: 'GLSearch',
title: 'GLTableButton', link: '/components/GLSearch'
link: '/components/GLTableButton' },
}, {
{ title: 'GLTableButton',
title: 'GLCombiForm', link: '/components/GLTableButton'
link: '/components/GLCombiForm' },
}, {
{ title: 'GLCombiForm',
title: 'GLProvince', link: '/components/GLCombiForm'
link: '/components/GLProvince' },
}, {
] title: 'GLProvince',
}] link: '/components/GLProvince'
},
{
title: 'GLDialog',
link: '/components/GLDialog'
},
]
},
{
title: '业务组件',
links: [{
title: 'GLBcTest',
link: '/components/GLBcTest'
}, ]
}
]
}) })
</script> </script>
</body> </body>
......
...@@ -7,26 +7,45 @@ const through2 = require('through2') ...@@ -7,26 +7,45 @@ const through2 = require('through2')
// // // 删除website/中的所有子目录 // // // 删除website/中的所有子目录
// async function clean(cb) { // async function clean(cb) {
// await del('./website') // await del('./website')
// cb() // // cb()
// } // }
// 迭代 components 下的所有 md 文件,并合并到 website/components 下的同名文件 // 迭代 components 下的所有 md 文件,并合并到 website/components 下的同名文件
function generateMd() { function generateMd(path) {
return src('./src/packages/**/*.md').pipe( return src(path).pipe(
through2.obj(function(file, _, cb) { through2.obj(function(file, _, cb) {
// console.log('file: ', file);
let filename = file.path.split(/\\/).pop() let filename = file.path.split(/\\/).pop()
console.log(filename) console.log(filename)
if (file.isBuffer()) { if (file.isBuffer()) {
try { try {
fs.readFile(`./website/components/${filename}`, (err, data) => { fs.readFile(`./website/components/${filename}`, (err, data) => {
const originalData = data.toString().replace(/<!-- <content> -->[\s\S]*<!-- <\/content> -->/g, '') // console.log('data: ', data);
if (err) throw err if (data) {
let fileContent = file.contents.toString() + '\n\n' + originalData // 存在合并
fs.writeFile(`./website/components/${filename}`, fileContent, err => { const originalData = data.toString().replace(/<!-- <content> -->[\s\S]*<!-- <\/content> -->/g, '')
if (err) return console.error(err) if (err) throw err
console.log(`写入 ${filename} 成功`) let fileContent = file.contents.toString() + '\n\n' + originalData
cb() fs.writeFile(`./website/components/${filename}`, fileContent, err => {
}) if (err) return console.error(err)
// console.log(`写入 ${filename} 成功`)
cb()
})
} else {
// 不存在创建
let filePath
if (filename === 'README.md') {
filePath = `./website/${filename}`
} else {
filePath = `./website/components/${filename}`
}
let fileContent = file.contents.toString()
fs.writeFile(filePath, fileContent, err => {
if (err) return console.error(err)
console.log(`写入 ${filename} 成功`)
cb()
})
}
}) })
} catch (exception) { } catch (exception) {
cb() cb()
...@@ -36,6 +55,11 @@ function generateMd() { ...@@ -36,6 +55,11 @@ function generateMd() {
) )
} }
async function generateAllMd() {
await generateMd('./src/packages/**/*.md')
await generateMd('./src/bcPackages/**/*.md')
}
function copyFile() { function copyFile() {
// return src(['./dist/*.js','./dist/*.css','./documents/index.html']).pipe(dest('./website/')) // return src(['./dist/*.js','./dist/*.css','./documents/index.html']).pipe(dest('./website/'))
...@@ -47,10 +71,10 @@ function copyFonts() { ...@@ -47,10 +71,10 @@ function copyFonts() {
// require("./build/gulp.css.js") // require("./build/gulp.css.js")
//监听这些文件的变换,不需要cb //监听这些文件的变换,不需要cb(只监听*.md,变化刷新)
function watcher() { function watcher() {
watch('src/**/*.*', generateMd, copyFile, copyFonts) watch('src/**/*.*', generateAllMd, copyFile, copyFonts)
watch('documents/**/*.*', generateMd, copyFile, copyFonts) watch('documents/**/*.*', generateAllMd, copyFile, copyFonts)
} }
exports.default = series([generateMd, copyFile, copyFonts, watcher]) exports.default = series([generateAllMd, copyFile, copyFonts, watcher])
This diff could not be displayed because it is too large.
{ {
"name": "glsx-components", "name": "glsx-components",
"description": "glsx vue components", "description": "glsx vue components",
"version": "1.4.0", "version": "1.4.7",
"author": "limin <17653212@qq.com>", "author": "limin <17653212@qq.com>",
"license": "MIT", "license": "MIT",
"main": "dist/glsx-components.common.js", "main": "dist/glsx-components.common.js",
...@@ -24,10 +24,14 @@ ...@@ -24,10 +24,14 @@
"vue-amap": "^0.5.10" "vue-amap": "^0.5.10"
}, },
"devDependencies": { "devDependencies": {
"@vue/babel-helper-vue-jsx-merge-props": "^1.2.1",
"@vue/babel-preset-jsx": "^1.3.0",
"@vue/cli-plugin-babel": "~4.5.0", "@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-service": "~4.5.0", "@vue/cli-service": "~4.5.0",
"@vuese/cli": "^2.14.3",
"concurrently": "^7.1.0", "concurrently": "^7.1.0",
"del": "^6.0.0", "del": "^6.0.0",
"gulp": "^4.0.2",
"gulp-autoprefixer": "^8.0.0", "gulp-autoprefixer": "^8.0.0",
"gulp-concat": "^2.6.1", "gulp-concat": "^2.6.1",
"gulp-cssmin": "^0.2.0", "gulp-cssmin": "^0.2.0",
...@@ -35,7 +39,6 @@ ...@@ -35,7 +39,6 @@
"gulp-sass": "^5.0.0", "gulp-sass": "^5.0.0",
"node-sass": "^4.14.1", "node-sass": "^4.14.1",
"sass-loader": "^8.0.0", "sass-loader": "^8.0.0",
"vue-template-compiler": "^2.6.11", "vue-template-compiler": "^2.6.11"
"vuese": "^1.4.7"
} }
} }
import GLBcTest from './src/index.vue'
// 为组件提供 install 安装方法,供按需引入
GLBcTest.install = function(Vue) {
Vue.component(GLBcTest.name, GLBcTest)
}
// 默认导出组件
export default GLBcTest
\ No newline at end of file \ No newline at end of file
<!-- <content> -->
<test-comp @click='btnClick'>常规按钮</test-comp>
<test-comp @click='btnClick' type='success'>成功按钮</test-comp>
<el-button type="warning" @click="toggleShow(1)">显示代码</el-button>
```js {mixin:true}
{
data() {
return {
demo1: true
}
},
methods:{
btnClick(){
alert('点击')
},
toggleShow(num){
// console.log(123)
this['demo' + num] = !this['demo' + num]
}
}
}
```
# 用来作为 markdown 代码的示例部分
<!-- <div v-if="demo1"> -->
```html
<template>
<test-comp @click="btnClick">常规按钮</test-comp>
<test-comp @click="btnClick" type="success">成功按钮</test-comp>
<test-comp @click="btnClick">789</test-comp>
</template>
<script>
export default {
data() {
return {}
},
methods: {
btnClick() {
alert('点击')
}
}
}
</script>
```
<!-- </div> -->
<!-- </content> -->
<template>
<div class="testcomp">
<el-button @click="btnClick" v-bind="$attrs" v-on="$listeners">
<!-- 默认插槽 -->
<slot>GLBcTest</slot>
</el-button>
</div>
</template>
<script>
// @group GroupA
export default {
name:'GLBcTest',
props:{
// bc类型的种类
demosize:{
type:String,
// `medium` / `small` / `mini`
default:'medium'
},
// demo类型
demotype:{
type:String,
// `primary` / `success`
default:'primary'
}
},
data(){
return{
}
},
methods:{
btnClick(){
// 这是点击事件
this.$emit('点击')
}
}
}
</script>
<style lang="scss">
.testcomp{
display:inline-block;
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -3,12 +3,24 @@ ...@@ -3,12 +3,24 @@
*/ */
import Vue from 'vue' import Vue from 'vue'
import GLButton from './packages/Button' import GLButton from './packages/Button'
const componentsFiles = require.context(`./packages`, true, /\.vue$/)
componentsFiles.keys().forEach(path => { //自动读取并注册组件
const component = componentsFiles(path).default function registerComp(componentsFiles){
// console.log('component: ', component); componentsFiles.keys().forEach(path => {
Vue.component(component.name, component) const component = componentsFiles(path).default
}) // console.log('component: ', component);
Vue.component(component.name, component)
})
}
function registerComponent(){
const componentsFiles = require.context('./packages', true, /\.vue$/)
registerComp(componentsFiles)
const componentsFilesBc = require.context('./bcPackages', true, /\.vue$/)
registerComp(componentsFilesBc)
}
registerComponent()
//函数组件 //函数组件
const permissions = { const permissions = {
......
...@@ -3,9 +3,10 @@ ...@@ -3,9 +3,10 @@
* 启动项目工程即可 * 启动项目工程即可
*/ */
//创建的组件 //创建的组件
import Vue from 'vue' import Vue from 'vue'
import { import {
// 基础
GLExternal, GLExternal,
GLButton, GLButton,
GLDialog, GLDialog,
...@@ -14,23 +15,32 @@ ...@@ -14,23 +15,32 @@
GLSearch, GLSearch,
GLSearchItem, GLSearchItem,
GLCombiForm, GLCombiForm,
GLTableButton GLTableButton,
// 业务
GLProvince,
GLBcTest,
GLEditor,
GLFull
} from '../../dist/glsx-components.umd.min.js' } from '../../dist/glsx-components.umd.min.js'
import '../../dist/glsx-components.css' import '../../dist/glsx-components.css'
const permissions = { const permissions = {
routes: [ routes: [
{ path: '/', meta: { permissions: ['1-1-1-1', '2-1-1-1', '3-1-1-1'] } }, { path: '/', meta: { permissions: ['1-1-1-1', '2-1-1-1', '3-1-1-1'] } },
{ path: '/a', meta: {} } { path: '/a', meta: {} }
], ],
routerBase: '' routerBase: ''
} }
Vue.use(GLButton, permissions) Vue.use(GLButton, permissions)
Vue.use(GLExternal) Vue.use(GLExternal)
Vue.use(GLDialog) Vue.use(GLDialog)
Vue.use(GLTable) Vue.use(GLTable)
Vue.use(GLFooter) Vue.use(GLFooter)
Vue.use(GLSearch) Vue.use(GLSearch)
Vue.use(GLSearchItem) Vue.use(GLSearchItem)
Vue.use(GLCombiForm) Vue.use(GLCombiForm)
Vue.use(GLTableButton) Vue.use(GLTableButton)
Vue.use(GLProvince)
Vue.use(GLBcTest)
Vue.use(GLEditor)
Vue.use(GLFull)
...@@ -6,6 +6,26 @@ ...@@ -6,6 +6,26 @@
```html ```html
更新日志 更新日志
v1.4.6
1.修复多个弹窗共存无法放大问题
v1.4.4
1.按钮(大中小)添加,样式调整
2.修复GlTableButton修复更多点击空白,触发事件
3.修复条件搜索展开 多 margin 20问题
4.组件库新增区分业务模块和基本模块
5.修复组件库全局引入使用问题
6.新增弹窗组件GLDialog
v1.4.3
1.调试处理table多级表头的顺序问题,动态columns
2.table search添加双选择框,选项
3.表头高度调整为48px
4.setTableHeightFun增加第二个参数添加高度(第一个参数减值,第二个参数增值)
5.调整tablecell无数据的“--”状态,不包含数字0,
6.添加gltablebutton中attrs的属性为函数的情况,传入该项和配置执行
v1.4.2 v1.4.2
1.调整GlTableButton、GlCombiForm穿透属性顺序 1.调整GlTableButton、GlCombiForm穿透属性顺序
2.修改table无数据的单元格状态 -- 2.修改table无数据的单元格状态 --
......
...@@ -7,7 +7,7 @@ export default { ...@@ -7,7 +7,7 @@ export default {
name: 'Blog', name: 'Blog',
props: { props: {
// 1.XX新增 // 1.XX新增
// hello // hello123
end: { end: {
type: String, type: String,
default: '' default: ''
......
<!-- <content> -->
# 调整el-button(不是 GLButton用法)
<h3>调整 el-button尺寸 大40 中32 小24</h3>
<div>
<el-button type="primary">一级</el-button>
<el-button type="primary" disabled>一级</el-button>
<el-button type="primary" :loading="true" icon="el-icon-star-off"></el-button>
</div>
<div>
<el-button plain>二级</el-button>
<el-button plain disabled>二级</el-button>
</div>
<div>
<el-button plain size="small" class="btn-three">三级</el-button>
<el-button plain size="small" class="btn-three" disabled>三级</el-button>
</div>
<div>
<el-button type="text">文字</el-button>
<el-button type="text" disabled>文字</el-button>
</div>
<div>
<el-button type="text" class="btn-link gap8">link按钮</el-button>
<el-button type="text" class="btn-link gap8" disabled>link按钮</el-button>
</div>
<div>
<el-button plain class="btn-three" size="mini">超小</el-button>
<el-button plain class="btn-three" size="mini" disabled>超小</el-button>
</div>
<el-button type="warning" @click="toggleShow(1)">显示代码</el-button>
```js {mixin:true}
{
data() {
return {
demo1: true
}
},
methods:{
btnClick(){
alert('点击')
},
toggleShow(num){
// console.log(123)
this['demo' + num] = !this['demo' + num]
}
}
}
```
<!-- ## 用来作为 markdown 代码的示例部分 -->
<div v-if="demo1">
```html
<template>
<div>
<!-- GLButton用法 -->
<GLButton @click="click" fn="1-1-1-11" mode="el-button">232321321</GLButton>
<div>
<el-button type="primary">一级</el-button>
<el-button type="primary" disabled>一级</el-button>
<el-button type="primary" :loading="true" icon="el-icon-star-off"></el-button>
</div>
<div>
<el-button plain>二级</el-button>
<el-button plain disabled>二级</el-button>
</div>
<div>
<el-button plain size="small" class="btn-three">三级</el-button>
<el-button plain size="small" class="btn-threethree" disabled>三级</el-button>
</div>
<div>
<el-button type="text">文字</el-button>
<el-button type="text" disabled>文字</el-button>
</div>
<div>
<el-button type="text" class="btn-link gap8">link按钮</el-button>
<el-button type="text" class="btn-link gap8" disabled>link按钮</el-button>
</div>
<div>
<el-button plain class="btn-three" size="mini">超小</el-button>
<el-button plain class="btn-three" size="mini" disabled>超小</el-button>
</div>
</div>
</template>
<script>
export default {
data() {
return {}
}
}
</script>
```
</div>
<!-- </content> -->
\ No newline at end of file \ No newline at end of file
...@@ -32,17 +32,21 @@ function __getRoutes(ctx) { ...@@ -32,17 +32,21 @@ function __getRoutes(ctx) {
return routes.find(route => location.pathname === `${routerBase}${route.path.split(':/')[0]}`) return routes.find(route => location.pathname === `${routerBase}${route.path.split(':/')[0]}`)
} }
// GLButton权限按钮组件
export default { export default {
functional: true, functional: true,
name: 'GLButton', name: 'GLButton',
props: { props: {
// fn权限对应的名字
fn: { fn: {
type: String type: String
}, },
// 生成的组件类型
mode: { mode: {
type: String, type: String,
default: 'el-button' default: 'el-button'
}, },
// 是否显示
display: { display: {
type: String, type: String,
default: '' default: ''
......
import GLEditor from './src/index.vue'
console.log(GLEditor)
// 为组件提供 install 安装方法,供按需引入
GLEditor.install = function (Vue) {
Vue.component(GLEditor.name, GLEditor)
}
// 默认导出组件
export default GLEditor
<template>
<div class="ly-emotion">
<slot></slot>
</div>
</template>
<script>
import emoji from '../../../utils/emo'
export default {
name: 'ly-emotion',
mounted() {
const name = this.$el.innerHTML
const list = emoji.flat(Infinity)
let index = parseInt(list.indexOf(name)) + 1
if (index < 10) {
index = '00' + index
} else if (index >= 10 && index < 100) {
index = '0' + index
}
let imgHTML = `<img src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/${index}.png">`
this.$nextTick(() => {
this.$el.innerHTML = imgHTML
})
}
}
</script>
<style scoped>
.ly-emotion {
display: inline-block;
}
.ly-static-emotion {
width: 24px;
height: 24px;
display: inline-block;
}
</style>
<template>
<div>
<div class="emotion-box" :style="{ height: height + 'px' }">
<div class="emotion-box-line" v-for="(line, i) in list" :key="i">
<emotion class="emotion-item" v-for="(item, i) in line" :key="i" @click.native="clickHandler(item)">{{ item }}</emotion>
</div>
</div>
</div>
</template>
<script>
import emoji from '../../../utils/emo'
import Emotion from './Emotion'
export default {
props: {
height: {
type: Number,
default: 200
}
},
name: 'emotionWords',
data() {
return {
list: emoji
}
},
methods: {
clickHandler(i) {
let emotion = `${i}`
this.$emit('emotion', emotion)
}
},
components: {
Emotion
}
}
</script>
<style scoped lang="scss">
.emotion-box {
z-index: 2004;
background-color: #fff;
border-radius: 2px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.15);
width: 300px;
box-sizing: border-box;
padding: 5px;
overflow: hidden;
overflow-y: auto;
}
.emotion-box-line {
display: flex;
}
.emotion-item {
flex: 1;
text-align: center;
cursor: pointer;
line-height: 23px;
/deep/ {
img {
width: 24px;
-webkit-user-select: none;
cursor: default;
pointer-events: none;
}
}
}
</style>
<template> <template>
<div <div class="scrm-footer-panel">
<!-- <div
class="scrm-footer-panel" class="scrm-footer-panel"
:style="{ :style="{
left: footerLeft + 'px', left: footerLeft + 'px',
width: footerWidth + 'px' width: footerWidth + 'px'
}" }"
> > -->
<slot></slot> <slot></slot>
</div> </div>
</template> </template>
<script> <script>
import { utils } from 'glsx-common'
export default { export default {
name: 'GLFooter', name: 'GLFooter',
props: { props: {
...@@ -21,21 +23,25 @@ export default { ...@@ -21,21 +23,25 @@ export default {
data() { data() {
return { return {
footerLeft: 0, footerLeft: 0,
footerWidth: 0 footerWidth: 0,
aside: ''
} }
}, },
methods: { methods: {
resize() { resize: utils.debounce(function () {
this.footerLeft = document.querySelector(this.className)?document.querySelector(this.className).offsetLeft : 0 this.footerLeft = document.querySelector(this.className) ? document.querySelector(this.className).offsetLeft : 0
this.footerWidth = document.documentElement.clientWidth - this.footerLeft this.footerWidth = document.documentElement.clientWidth - this.footerLeft
} }, 100)
}, },
destroyed() { destroyed() {
window.removeEventListener('resize', this.resize) window.removeEventListener('resize', this.resize)
this.aside && this.aside.removeEventListener('DOMSubtreeModified', this.resize)
}, },
mounted() { mounted() {
this.resize() // this.resize()
window.addEventListener('resize', this.resize) // this.aside = document.querySelector('.base-container-aside')
// this.aside && this.aside.addEventListener('DOMSubtreeModified', this.resize)
// window.addEventListener('resize', this.resize)
} }
} }
</script> </script>
...@@ -45,10 +51,9 @@ export default { ...@@ -45,10 +51,9 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
position: fixed; position: static !important;
bottom: 0px; height: auto !important;
height: 64px; background: none !important;
background: #ffffff; box-shadow: none !important;
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
} }
</style> </style>
<template>
<div class="gl-dialog-wrap " :class="mode" :id="idDom">
<el-dialog v-bind="$attrs" v-on="$listeners">
<template v-slot:title>
<!-- 标题插槽 -->
<slot name="title" v-if="!bigTitle"></slot>
<template v-if="bigTitle">
<template v-if="mode === 'big'">
<span class="el-dialog__title" v-if="!$slots.custombigtitle">
{{ bigTitle }}
</span>
<span class="el-dialog__title" v-if="$slots.custombigtitle">
<!-- 大弹窗自定义插槽 -->
<slot name="custombigtitle"></slot>
</span>
<button type="button" aria-label="Close" class="el-dialog__headerbtn">
<!-- <i v-if="mode === 'big'" class="el-icon-full-screen full-screen" @click="fullScreenFn"></i> -->
<i v-if="mode === 'big'" :class="isFull ? 's-full-screen' : 'full-screen'" @click="fullScreenFn"></i>
<!-- <i class="el-icon-close "></i> -->
</button>
</template>
</template>
</template>
<template v-slot:default>
<!-- 默认插槽 -->
<slot name="default" v-if="!content"></slot>
<template v-if="content">
<div v-if="mode === 'small'" class="small-content">
<i :class="iconType"></i>
<div class="content">{{ content }}</div>
</div>
<div v-else class="content">{{ content }}</div>
</template>
</template>
<template v-slot:footer v-if="hasFooter">
<template v-if="!$slots.footer">
<span class="dialog-footer">
<el-button plain size="small" class="btn-three" @click="cancel">{{ cancelName }}</el-button>
<el-button type="primary" size="small" @click="ok">{{ okName }}</el-button>
</span>
</template>
<!-- footer插槽 -->
<slot name="footer" v-if="$slots.footer"></slot>
</template>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'GLDialog',
inheritAttrs: false,
// 传入width会覆盖默认的宽度
props: {
// 弹框模式
mode: {
type: String,
// `big` / `mid` / `small`
default: 'mid'
},
// 是否有按钮
hasFooter: {
type: Boolean,
default: true
},
// 取消按钮名称
cancelText: {
type: String,
default: ''
},
// 确定按钮名称
okText: {
type: String,
default: ''
},
// 大标题(不与title(低)共存)
bigTitle: {
type: String,
default: ''
},
// 内容(small生效)
content: {
type: String,
default: ''
},
// 消息类型(图标,small生效)
type: {
type: String,
// `success` / `info` / `warning` / `error`
default: ''
}
},
data() {
return {
isFull: false,
idDom:Math.random().toString(36).slice(-8)
}
},
mounted(){
document.addEventListener('keyup', (e)=>{
this.keyupHook(e)
});
},
computed: {
okName: function() {
let resName
switch (this.mode) {
case 'small':
resName = this.okText ? this.okText : '是'
break
default:
resName = this.okText ? this.okText : '确定'
break
}
return resName
},
cancelName: function() {
let resName
switch (this.mode) {
case 'small':
resName = this.cancelText ? this.cancelText : '否'
break
default:
resName = this.cancelText ? this.cancelText : '取消'
break
}
return resName
},
iconType: function() {
let type
switch (this.type) {
case 'success':
type = 'el-icon-success'
break
case 'info':
type = 'el-icon-info'
break
case 'warning':
type = 'el-icon-warning'
break
case 'error':
type = 'el-icon-error'
break
}
return type
}
},
methods: {
ok() {
// 这是确认事件
this.$emit('onOk')
},
cancel() {
// 这是取消事件
this.$emit('onCancel')
},
escFn(){
setTimeout(() => {
this.isFull = false
this.exitFullscreenHook()
},300)
},
fullScreenFn() {
if(this.isFull){
this.exitFullscreenHook()
this.isFull = false
}else{
this.fullScreenHook()
this.isFull = true
}
},
fullScreenHook(){
const rootdom = document.getElementById(this.idDom)
const dialog = rootdom.getElementsByClassName('el-dialog')[0]
const dialogBody = rootdom.getElementsByClassName('el-dialog__body')[0]
dialog.style.margin = 0
dialog.style.width = window.innerWidth +'px'
dialog.style.height = window.innerHeight +'px'
// dialogBody.style.maxHeight = window.innerHeight -60 -40 -64 + 'px'
dialogBody.style.minHeight = window.innerHeight -60 -40 -64 + 'px'
},
exitFullscreenHook(){
const rootdom = document.getElementById(this.idDom)
const dialog = rootdom.getElementsByClassName('el-dialog')[0]
const dialogBody = rootdom.getElementsByClassName('el-dialog__body')[0]
if(dialogBody){
// dialogBody.style.maxHeight = '586px'
dialogBody.style.minHeight = '156px'
}
dialog.style.margin = '15vh auto 50px'
dialog.style.width = 1080 +'px'
dialog.style.height = 'auto'
},
keyupHook(e){
if(this.isFull){
if( e.key === 'Escape'){
this.escFn()
}
}
}
},
beforeDestroy(){
document.removeEventListener('keyup',(e)=>{
this.keyupHook(e)
})
}
}
</script>
<style lang="scss">
.gl-dialog-wrap {
&.big {
.el-dialog {
width: 1080px;
}
.el-dialog__body {
min-height: 156px;
max-height: 586px;
}
}
&.mid {
.el-dialog {
width: 720px;
}
.el-dialog__body {
min-height: 156px;
max-height: 586px;
}
}
&.small {
.el-dialog {
width: 576px;
}
.el-dialog__body {
height: 152px;
}
.el-dialog__footer {
text-align: center;
}
.small-content {
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.el-icon-success {
font-size: 48px;
color: #67c23a;
}
.el-icon-info {
font-size: 48px;
color: #909399;
}
.el-icon-warning {
font-size: 48px;
color: #e6a23c;
}
.el-icon-error {
font-size: 48px;
color: #f56c6c;
}
.content {
margin-top: 16px;
}
}
}
.el-dialog__header {
padding: 16px 20px;
.el-dialog__headerbtn {
top: 18px;
font-size: 24px;
font-weight: 600;
line-height: 24px;
color: #000;
.full-screen {
display: block;
margin-right: 34px;
width: 24px;
height: 24px;
background-image: url('../../../assets/full-screen.png');
background-size: 100% 100%;
// &:hover {
// color: $color-primary;
// }
}
.s-full-screen {
display: block;
margin-right: 34px;
width: 24px;
height: 24px;
background-image: url('../../../assets/s-full-screen.png');
background-size: 100% 100%;
}
}
}
.el-dialog__body {
padding: 20px;
overflow: auto;
}
.el-dialog__footer {
padding: 15px 20px 16px;
}
.el-table .el-table__row td {
height: 40px;
}
}
</style>
import GLFull from './src/index.vue'
// 为组件提供 install 安装方法,供按需引入
GLFull.install = function (Vue) {
Vue.component(GLFull.name, GLFull)
}
// 默认导出组件
export default GLFull
<template>
<div class="full-container">
<el-tooltip placement="top" v-if="hoverStatus">
<div slot="content">
<template v-if="$slots.default"><slot></slot></template>
<template v-else>
{{ label }}
</template>
</div>
<div :class="['full-text', identification]" :style="{ width: labelWidth + 'px' }" @mouseenter="hoverFun" v-if="textType != 'text' && !haveClose">
<el-tag type="info" class="full-text" :disable-transitions="false">
<i class="el-icon-user-solid" v-if="textType == 'user'"></i>
{{ label }}
</el-tag>
</div>
<div v-if="textType != 'text' && haveClose" @mouseenter="hoverFun">
<el-tag class="tag-user-closable" :style="{ 'max-width': labelWidth + 'px' }" type="info" :disable-transitions="false" closable @close="handleRemove">
<i class="el-icon-user-solid" v-if="textType == 'user'"></i>
<span :class="['full-text-user', { 'user-icon-checked': textType == 'user' && haveClose }, identification]">{{ label }}</span>
</el-tag>
</div>
<div :class="[line ? 'full-text-line' : 'full-text', identification]" @mouseenter="hoverFun" :style="{ width: labelWidth + 'px', '-webkit-line-clamp': line }" v-if="textType == 'text'">
<template v-if="$slots.default"><slot></slot></template>
<template v-else>
{{ label }}
</template>
</div>
</el-tooltip>
<template v-else>
<div :class="['full-text', identification]" @mouseenter="hoverFun" :style="{ width: labelWidth + 'px' }" v-if="textType != 'text' && !haveClose">
<el-tag type="info" class="full-text" :disable-transitions="false">
<i class="el-icon-user-solid" v-if="textType == 'user'"></i>
{{ label }}
</el-tag>
</div>
<div @mouseenter="hoverFun" v-if="textType != 'text' && haveClose">
<el-tag class="tag-user-closable" type="info" :style="{ 'max-width': labelWidth + 'px' }" :disable-transitions="false" closable @close="handleRemove">
<i class="el-icon-user-solid" v-if="textType == 'user'"></i>
<span :class="['full-text-user', identification]">{{ label }}</span>
</el-tag>
</div>
<div :class="[line ? 'full-text-line' : 'full-text', identification]" @mouseenter="hoverFun" :style="{ width: labelWidth + 'px', '-webkit-line-clamp': line }" v-if="textType == 'text'">
<template v-if="$slots.default"><slot></slot></template>
<template v-else>
{{ label }}
</template>
</div>
</template>
</div>
</template>
<script>
export default {
name: 'GLFull',
data() {
return {
hoverStatus: false
}
},
props: {
//唯一标识
identi: {
type: String,
default: 'identi'
},
//文本
label: {
type: String,
default: ''
},
//文本宽度
labelWidth: {
type: Number,
default: 100
},
//行数
line: {
type: Number,
default: 0
},
textType: {
type: String,
default: 'text', // text 文本 user 跟进员工 tag 标签
validator: function (value) {
return ['text', 'user', 'tag'].indexOf(value) !== -1
}
},
//是否包含关闭按钮
haveClose: {
type: Boolean,
default: false
}
},
computed: {
identification() {
return 'text_' + this.identi
}
},
methods: {
hoverFun() {
if (this.haveClose) {
//this.hoverStatus = this.identi ? document.querySelector(`.${this.identification}`).scrollWidth > document.querySelector(`.${this.identification}`).offsetWidth : document.querySelector(`.full-text`).scrollWidth > this.labelWidth - 30
this.hoverStatus = document.querySelector(`.${this.identification}`).scrollWidth > document.querySelector(`.${this.identification}`).offsetWidth
} else {
let widthMuti = this.textType == 'user' ? 17 : this.textType == 'tag' ? 20 : 0
// this.hoverStatus = this.identi ? document.querySelector(`.${this.identification}`).scrollWidth - widthMuti > this.labelWidth : document.querySelector(`.full-text`).scrollWidth > this.labelWidth
this.hoverStatus = document.querySelector(`.${this.identification}`).scrollWidth - widthMuti > this.labelWidth
}
},
handleRemove() {
this.$emit('handleRemove')
}
}
}
</script>
<style scoped lang="scss">
.full-container {
display: inline-block;
/deep/ {
.el-tag {
height: 26px;
line-height: 26px;
}
}
}
.full-text {
max-width: 100%;
display: inline-block;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.full-text-user {
max-width: calc(100% - 14px);
display: inline-block;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
&.user-icon-checked {
max-width: calc(100% - 30px);
}
}
.tag-user-closable {
display: flex;
align-items: center;
/deep/ {
.el-icon-close {
margin-top: 2px;
}
}
}
.full-text-line {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
word-break: break-all;
}
.el-icon-user-solid {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
</style>
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
<div class="operate"> <div class="operate">
<el-button size="small" type="primary" @click="handleOkFn">查询</el-button> <el-button size="small" type="primary" @click="handleOkFn">查询</el-button>
<el-button size="small" @click="handleRestFn">重置</el-button> <el-button size="small" @click="handleRestFn">重置</el-button>
<el-button type="text" size="small" @click="expandFn" v-if="hasExpand"> <el-button type="text" size="small" class="gl-padding0" @click="expandFn" v-if="hasExpand">
<span>{{ !expand ? '展开' : '收起' }}</span> <span>{{ !expand ? '展开' : '收起' }}</span>
<i class="expand" :class="classIcon"></i> <i class="expand" :class="classIcon"></i>
</el-button> </el-button>
...@@ -247,17 +247,17 @@ export default { ...@@ -247,17 +247,17 @@ export default {
const clientWidth = window.innerWidth const clientWidth = window.innerWidth
if (clientWidth <= 1062) { if (clientWidth <= 1062) {
// 1个1行
this.hasExpand = this.ifHasExpand(1)
} else if (clientWidth <= 1440 && clientWidth > 1062) {
// 2个1行 // 2个1行
this.hasExpand = this.ifHasExpand(2) this.hasExpand = this.ifHasExpand(2)
} else if (clientWidth <= 1720 && clientWidth > 1440) { } else if (clientWidth <= 1440 && clientWidth > 1062) {
// 3个1行 // 3个1行
this.hasExpand = this.ifHasExpand(3) this.hasExpand = this.ifHasExpand(3)
} else { } else if (clientWidth <= 1720 && clientWidth > 1440) {
// 4个1行 // 4个1行
this.hasExpand = this.ifHasExpand(4) this.hasExpand = this.ifHasExpand(4)
} else {
// 5个1行
this.hasExpand = this.ifHasExpand(5)
} }
}, 100) }, 100)
}, },
...@@ -310,7 +310,7 @@ export default { ...@@ -310,7 +310,7 @@ export default {
} */ } */
@media screen and (max-width: 1062px) { @media screen and (max-width: 1062px) {
.glsx-combi-form .el-form-item--small { .glsx-combi-form .el-form-item--small {
width: 100%; width: 50%;
} }
.glsx-combi-form .el-form-item--small .el-form-item__content { .glsx-combi-form .el-form-item--small .el-form-item__content {
width: 100%; width: 100%;
...@@ -321,7 +321,7 @@ export default { ...@@ -321,7 +321,7 @@ export default {
} }
@media screen and (min-width: 1062px) and (max-width: 1440px) { @media screen and (min-width: 1062px) and (max-width: 1440px) {
.glsx-combi-form .el-form-item--small { .glsx-combi-form .el-form-item--small {
width: 50%; width: 33.33%;
} }
.glsx-combi-form .el-form-item--small .el-form-item__content { .glsx-combi-form .el-form-item--small .el-form-item__content {
width: 100%; width: 100%;
...@@ -332,7 +332,7 @@ export default { ...@@ -332,7 +332,7 @@ export default {
} }
@media screen and (min-width: 1440px) and (max-width: 1720px) { @media screen and (min-width: 1440px) and (max-width: 1720px) {
.glsx-combi-form .el-form-item--small { .glsx-combi-form .el-form-item--small {
width: 33.33%; width: 25%;
} }
.glsx-combi-form .el-form-item--small .el-form-item__content { .glsx-combi-form .el-form-item--small .el-form-item__content {
width: 100%; width: 100%;
...@@ -343,7 +343,7 @@ export default { ...@@ -343,7 +343,7 @@ export default {
} }
@media screen and (min-width: 1720px) { @media screen and (min-width: 1720px) {
.glsx-combi-form .el-form-item--small { .glsx-combi-form .el-form-item--small {
width: 25%; width: 20%;
} }
.glsx-combi-form .el-form-item--small .el-form-item__content { .glsx-combi-form .el-form-item--small .el-form-item__content {
width: 100%; width: 100%;
......
...@@ -202,7 +202,6 @@ export default { ...@@ -202,7 +202,6 @@ export default {
.operate { .operate {
text-align: left; text-align: left;
width: 190px; width: 190px;
margin-bottom: 20px;
.expand { .expand {
font-size: 14px; font-size: 14px;
} }
......
<!-- <content> --> <!-- <content> -->
# GLTableButton
<GLTable ref="liveRoomRef" :tableParams="tableParams" :tableData="tableData"> <GLTable ref="liveRoomRef" :tableParams="tableParams" :tableData="tableData">
<span class="table-btns" slot="auth-button" slot-scope="scope" :data="scope.scope"> <span class="table-btns" slot="auth-button" slot-scope="scope" :data="scope.scope">
...@@ -207,7 +208,7 @@ ...@@ -207,7 +208,7 @@
} }
``` ```
# 用来作为 markdown 代码的示例部分 <!-- # 用来作为 markdown 代码的示例部分 -->
<div v-if="demo1"> <div v-if="demo1">
......
<script> <script>
import { hasPermission } from '../../Button' import { hasPermission } from '../../Button'
import { objectType } from '../../../utils/index' import { objectType } from '../../../utils/index'
import { utils } from 'glsx-common'
export default { export default {
name: 'GLTableButton', name: 'GLTableButton',
props: { props: {
...@@ -20,29 +21,6 @@ export default { ...@@ -20,29 +21,6 @@ export default {
default: 3 default: 3
} }
}, },
data() {
return {
// buttonList: [
// {
// type: 'el-button',
// name: '编辑',
// condition: row => {
// console.log('row: ', row)
// return false
// },
// attrs: {
// type: 'text'
// },
// listeners: {
// click: this.conditionFn
// }
// }
// ]
}
},
mounted() {
// console.log(hasPermission.call(this, '1-1-1-1'))
},
render() { render() {
/** /**
* 创建el button 实例 * 创建el button 实例
...@@ -55,9 +33,7 @@ export default { ...@@ -55,9 +33,7 @@ export default {
onClick={() => { onClick={() => {
component.listeners.click(this.buttonItem, component) component.listeners.click(this.buttonItem, component)
}} }}
domPropsInnerHTML={component.name ? (objectType(component.name) == 'String' ? component.name : component.name(this.buttonItem)) : ''}> domPropsInnerHTML={component.name ? (objectType(component.name) == 'String' ? component.name : component.name(this.buttonItem)) : ''}></el-button>
// {component.name}
</el-button>
) )
} }
/** /**
...@@ -71,9 +47,7 @@ export default { ...@@ -71,9 +47,7 @@ export default {
onClick={() => { onClick={() => {
component.listeners.click(this.buttonItem, component) component.listeners.click(this.buttonItem, component)
}} }}
domPropsInnerHTML={component.name ? (objectType(component.name) == 'String' ? component.name : component.name(this.buttonItem)) : ''}> domPropsInnerHTML={component.name ? (objectType(component.name) == 'String' ? component.name : component.name(this.buttonItem)) : ''}></GLButton>
// {component.name}
</GLButton>
) )
} }
/** /**
...@@ -104,6 +78,17 @@ export default { ...@@ -104,6 +78,17 @@ export default {
// //1.筛选过滤条件 // //1.筛选过滤条件
const componentList = this.buttonList const componentList = this.buttonList
.map(item => { .map(item => {
//处理attrs中属性为函数情况
item = utils.deepClone(item)
let attrKeys = item.attrs ? Object.keys(item.attrs) : []
if (attrKeys.length > 0) {
for (let key of attrKeys) {
if (objectType(item.attrs[key]) === 'Function') {
item.attrs[key] = item.attrs[key](this.buttonItem, item)
}
}
}
//不传条件,默认显示 //不传条件,默认显示
if (!item.condition) { if (!item.condition) {
return item return item
...@@ -125,8 +110,8 @@ export default { ...@@ -125,8 +110,8 @@ export default {
} else if (item.type == 'GLButton') { } else if (item.type == 'GLButton') {
status = item.condition(this.buttonItem, item) && hasPermission.call(this, item.attrs.fn) status = item.condition(this.buttonItem, item) && hasPermission.call(this, item.attrs.fn)
} }
//处理disabled情况(函数或者boolean) // //处理disabled情况(函数或者boolean)
item.attrs.disabled = item.attrs.disabled ? (objectType(item.attrs.disabled) === 'Function' ? item.attrs.disabled(this.buttonItem, item) : item.attrs.disabled) : false // item.attrs.disabled = item.attrs.disabled ? (objectType(item.attrs.disabled) === 'Function' ? item.attrs.disabled(this.buttonItem, item) : item.attrs.disabled) : false
if (status) { if (status) {
return item return item
...@@ -151,7 +136,9 @@ export default { ...@@ -151,7 +136,9 @@ export default {
selectComp = ( selectComp = (
<el-dropdown class="gl-dropdown"> <el-dropdown class="gl-dropdown">
<span class="el-dropdown-link">更多</span> <span class="el-dropdown-link">更多</span>
<el-dropdown-menu slot="dropdown">{postButtons.map(item => handleVNode(item, true))}</el-dropdown-menu> <el-dropdown-menu slot="dropdown" class="gl-dropdown-menu__item">
{postButtons.map(item => handleVNode(item, true))}
</el-dropdown-menu>
</el-dropdown> </el-dropdown>
) )
} else { } else {
...@@ -179,5 +166,20 @@ export default { ...@@ -179,5 +166,20 @@ export default {
margin-left: 10px; margin-left: 10px;
color: $color-primary; color: $color-primary;
} }
.el-button + .el-button {
margin-left: 10px;
}
}
.gl-dropdown-menu__item {
.el-dropdown-menu__item {
padding: 0;
.el-button--text {
// background: red;
width: 100%;
height: 36px;
display: inline-block;
padding: 0 20px;
}
}
} }
</style> </style>
## 首页
​
欢迎使用glsx-components组件库。
​
> npm install glsx-components --save
​
<!-- ---
​
1. 有序1
2. 有序2 -->
\ No newline at end of file \ No newline at end of file
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<script> <script>
export default { export default {
name: 'Popover', name: 'GLPopover',
props: { props: {
// props的种类参考el-popover // props的种类参考el-popover
demoProps: { demoProps: {
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
<!-- 递归 --> <!-- 递归 -->
<sub-el-table-column v-if="item.children" :data="item.children" :tableData="tableData" :getListApi="getListApi"></sub-el-table-column> <sub-el-table-column v-if="item.children" :data="item.children" :tableData="tableData" :getListApi="getListApi"></sub-el-table-column>
</el-table-column> </el-table-column>
<el-table-column v-if="tableParams.tableOption" label="操作" :align="tableParams.tableOption.align || 'left'" :width="tableParams.tableOption.width || '200'" fixed="right"> <el-table-column v-if="tableParams.tableOption" label="操作" :align="tableParams.tableOption.align || 'left'" :width="tableParams.tableOption.width || '200'" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -76,14 +77,14 @@ ...@@ -76,14 +77,14 @@
<script> <script>
import noDataImgUrl from '@/assets/empty.png' import noDataImgUrl from '@/assets/empty.png'
import SubElTableColumn from './sub-el-table-column.vue' import SubElTableColumn from './sub-el-table-column.vue'
import GlSubTableColumn from '../../GlSubTableColumn' // import GlSubTableColumn from '../../GlSubTableColumn'
import GlSubTable from '../../GlSubTable' // import GlSubTable from '../../GlSubTable'
export default { export default {
name: 'GLTable', name: 'GLTable',
components: { components: {
SubElTableColumn, SubElTableColumn,
GlSubTableColumn, // GlSubTableColumn,
GlSubTable // GlSubTable
}, },
props: { props: {
// `medium` / `small` / `mini` // `medium` / `small` / `mini`
......
<template>
<div class="sub-el-table-column">
<el-table-column v-for="(item, index) in reverseData" :key="index" :label="item.label" :prop="item.prop" :width="item.width" :min-width="item.minWidth" :fixed="item.fixed" :align="item.align || 'center'" :sortable="item.sortable" :render-header="item.renderHeader">
<template slot-scope="scope">
<slot v-if="item.addHtml" :name="item.addHtml" :scope="scope.row" :prop="item.prop" :width="item.width"></slot>
<template v-else-if="item.formatter">
<span class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }" :title="item.formatter(scope.row)" v-text="item.formatter(scope.row)"></span>
</template>
<template v-else-if="getListApi">
<span class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }" :title="scope.row[item.prop]" v-text="scope.row[item.prop]"></span>
</template>
<!-- <template v-else-if="item.labelchildren">
<el-table-column v-for="(labelitem, labelindex) in tableColumns.labelchildren" :key="'labelindex'+labelindex">
<span>123456</span>
</el-table-column> -->
<!-- <span class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }" :title="tableData[scope.$index][item.prop]" v-text="tableData[scope.$index][item.prop]"></span> -->
<!-- </template> -->
<template v-else>
<!-- 大于10或 20个字节长度 -->
<el-popover v-if="tableData[scope.$index][item.prop] && tableData[scope.$index][item.prop].length >= 10 * item.line" placement="top" title="标题" width="200" trigger="click" :content="tableData[scope.$index][item.prop]">
<span slot="reference" class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }" v-text="tableData[scope.$index][item.prop]"></span>
</el-popover>
<span v-else class="line-ellipsis" :style="{ '-webkit-line-clamp': item.line ? item.line : '' }" v-text="tableData[scope.$index][item.prop]"></span>
</template>
<template v-if="item.addSymbol">
<span v-text="item.addSymbol"></span>
</template>
</template>
<!-- 递归 -->
<sub-el-table-column v-if="item.children" :data="item.children"></sub-el-table-column>
</el-table-column>
</div>
</template>
<script>
export default {
name: 'sub-el-table-column',
props: {
data: {
type: Array,
default: () => []
}
},
computed: {
reverseData() {
return [...this.data].reverse()
}
}
// created(){
// // console.log('data',this.data)
// }
}
</script>
<style lang="scss">
// .sub-el-table-column {
// }
</style>
\ No newline at end of file \ No newline at end of file
...@@ -48,12 +48,14 @@ ...@@ -48,12 +48,14 @@
<!-- 递归 --> <!-- 递归 -->
<sub-el-table-column v-if="item.children" :data="item.children" :tableData="tableData" :getListApi="getListApi"></sub-el-table-column> <sub-el-table-column v-if="item.children" :data="item.children" :tableData="tableData" :getListApi="getListApi"></sub-el-table-column>
</el-table-column> </el-table-column>
</div> </div>
</template> </template>
<script> <script>
import GlSubTableColumn from '../../GlSubTableColumn' // import GlSubTableColumn from '../../GlSubTableColumn'
export default { export default {
name: 'sub-el-table-column', name: 'sub-el-table-column',
props: { props: {
...@@ -80,9 +82,9 @@ export default { ...@@ -80,9 +82,9 @@ export default {
return arr return arr
} }
}, },
components: { // components: {
GlSubTableColumn // GlSubTableColumn
} // }
// created(){ // created(){
// // console.log('data',this.data) // // console.log('data',this.data)
// } // }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
</template> </template>
<script> <script>
// @group GroupA
export default { export default {
name:'TestComp', name:'TestComp',
props:{ props:{
......
...@@ -3,31 +3,40 @@ ...@@ -3,31 +3,40 @@
*/ */
// 导入颜色选择器组件 // 导入颜色选择器组件
// import '@/plugins/element.js' // import '@/plugins/element.js'
import { Table, TableColumn, Popover, Button, ButtonGroup, Loading, Input, Form, FormItem, Pagination, Tooltip, Icon, Select, Option, DatePicker, Dropdown, DropdownItem, DropdownMenu } from '@/plugins/element.js' import { Table, TableColumn, Popover, Button, ButtonGroup, Loading, Input, Form, FormItem, Pagination, Tooltip, Icon, Select, Option, DatePicker, Dropdown, DropdownItem, DropdownMenu, Dialog, MessageBox } from '@/plugins/element.js'
import '@/theme/theme.scss' import '@/theme/theme.scss'
// 一次性注册所有的过滤器 本地测试 // 一次性注册所有的过滤器 本地测试
import filters from '@/filters' import filters from '@/filters'
// test 组件 // 导入基础组件
import TestComp from './TestComp' import TestComp from './TestComp'
import GLExternal from './External' import GLExternal from './External'
import GLButton from './Button' import GLButton from './Button'
import GLDialog from './Dialog' import GLDialog from './GLDialog'
import GLTable from './Table' import GLTable from './Table'
import GLFooter from './Footer' import GLFooter from './Footer'
import GLSearch from './GlSearch' import GLSearch from './GlSearch'
import GLSearchItem from './GlSearchItem' import GLSearchItem from './GlSearchItem'
import GLCombiForm from './GlCombiForm' import GLCombiForm from './GlCombiForm'
import GLTableButton from './GlTableButton' import GLTableButton from './GlTableButton'
// 导入业务组件
import GLProvince from './GLProvince' import GLProvince from './GLProvince'
import GLFull from './GLFull'
import GLEditor from './Editor'
import GLBcTest from '@/bcPackages/GLBcTest'
//el原始组件 //el原始组件
const ElComponent = [Table, TableColumn, Popover, Button, ButtonGroup, Loading, Input, Form, FormItem, Pagination, Tooltip, Icon, Select, Option, DatePicker, Dropdown, DropdownItem, DropdownMenu] const ElComponent = [Table, TableColumn, Popover, Button, ButtonGroup, Loading, Input, Form, FormItem, Pagination, Tooltip, Icon, Select, Option, DatePicker, Dropdown, DropdownItem, DropdownMenu, Dialog, MessageBox]
// 业务组件导入列表
const BcComponent = [GLBcTest]
// 存储组件列表 // 存储组件列表
const components = [TestComp, GLExternal, GLButton, GLDialog, GLTable, GLFooter, GLSearch, GLSearchItem, GLCombiForm, GLTableButton, GLProvince].concat(ElComponent) const components = [TestComp, GLExternal, GLButton, GLDialog, GLTable, GLFooter, GLSearch, GLSearchItem, GLCombiForm, GLTableButton, GLProvince, GLFull, GLEditor].concat(ElComponent).concat(BcComponent)
// console.log('components: ', components); // console.log('components: ', components);
// 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册 // 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
...@@ -39,17 +48,36 @@ const install = function (Vue) { ...@@ -39,17 +48,36 @@ const install = function (Vue) {
// 判断是否安装 // 判断是否安装
if (install.installed) return if (install.installed) return
// 遍历注册全局组件 // 遍历注册全局组件
components.map(component => Vue.component(component.name, component)) components.map(component => {
if (!component.name) return
Vue.component(component.name, component)
})
} }
// 判断是否是直接引入文件 // 判断是否是直接引入文件
if (typeof window !== 'undefined' && window.Vue) { if (typeof window !== 'undefined' && window.Vue) {
install(window.Vue) install(window.Vue)
} }
/**
*
* @param {*} compArr 组件数组,将他们转化为obj导出
* @returns compObj {}
*/
const getNameComp = compArr => {
if (compArr.length === 0) return
let compObj = {}
compArr.forEach(item => {
compObj[item.name] = item
})
return compObj
}
export default { export default {
// 导出的对象必须具有 install,才能被 Vue.use() 方法安装 // 导出的对象必须具有 install,才能被 Vue.use() 方法安装
install, install,
...ElComponent, ...getNameComp(ElComponent),
// ...BcComponent,
// 基础组件
TestComp, TestComp,
GLExternal, GLExternal,
GLButton, GLButton,
...@@ -60,5 +88,9 @@ export default { ...@@ -60,5 +88,9 @@ export default {
GLSearchItem, GLSearchItem,
GLCombiForm, GLCombiForm,
GLTableButton, GLTableButton,
GLProvince //业务组件
GLProvince,
GLBcTest,
GLFull,
GLEditor
} }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
*/ */
import Vue from 'vue' import Vue from 'vue'
import { Table, TableColumn, Popover, Button, ButtonGroup, Loading, Input, Form, FormItem, Pagination, Tooltip, Icon, Select, Option, DatePicker, Dropdown, DropdownItem, DropdownMenu, Dialog, Message, MessageBox } from 'element-ui' import { Table, TableColumn, Popover, Button, ButtonGroup, Loading, Input, Form, FormItem, Pagination, Tooltip, Icon, Select, Option, DatePicker, Dropdown, DropdownItem, DropdownMenu, Dialog, MessageBox } from 'element-ui'
// import 'element-ui/lib/theme-chalk/index.css' //todo 按需引入插件样式 // import 'element-ui/lib/theme-chalk/index.css' //todo 按需引入插件样式
import 'element-ui/lib/theme-chalk/table.css' import 'element-ui/lib/theme-chalk/table.css'
import 'element-ui/lib/theme-chalk/table-column.css' import 'element-ui/lib/theme-chalk/table-column.css'
...@@ -24,6 +24,8 @@ import 'element-ui/lib/theme-chalk/dropdown.css' ...@@ -24,6 +24,8 @@ import 'element-ui/lib/theme-chalk/dropdown.css'
import 'element-ui/lib/theme-chalk/dropdown-item.css' import 'element-ui/lib/theme-chalk/dropdown-item.css'
import 'element-ui/lib/theme-chalk/dropdown-menu.css' import 'element-ui/lib/theme-chalk/dropdown-menu.css'
import 'element-ui/lib/theme-chalk/dialog.css' import 'element-ui/lib/theme-chalk/dialog.css'
import 'element-ui/lib/theme-chalk/message.css'
import 'element-ui/lib/theme-chalk/message-box.css'
// 解决 ElTable 自动宽度高度导致的「ResizeObserver loop limit exceeded」问题 // 解决 ElTable 自动宽度高度导致的「ResizeObserver loop limit exceeded」问题
const fixElTableErr = table => { const fixElTableErr = table => {
...@@ -53,7 +55,8 @@ Vue.use(Dropdown) ...@@ -53,7 +55,8 @@ Vue.use(Dropdown)
Vue.use(DropdownItem) Vue.use(DropdownItem)
Vue.use(DropdownMenu) Vue.use(DropdownMenu)
Vue.use(Dialog) Vue.use(Dialog)
Vue.prototype.$message = Message // Vue.use(MessageBox)
Vue.prototype.$confirm = MessageBox.confirm
//打包后的组件dist 测试组件可能需要的 //打包后的组件dist 测试组件可能需要的
export { Table, TableColumn, Popover, Button, ButtonGroup, Loading, Input, Form, FormItem, Pagination, Tooltip, Icon, Select, Option, DatePicker, Dropdown, DropdownItem, DropdownMenu, Dialog, Message } export { Table, TableColumn, Popover, Button, ButtonGroup, Loading, Input, Form, FormItem, Pagination, Tooltip, Icon, Select, Option, DatePicker, Dropdown, DropdownItem, DropdownMenu, Dialog, MessageBox }
/**
重置样式,公共样式
*/
.gl-padding0{
padding: 0 !important;
}
.gl-margin0{
margin: 0 !important;
}
\ No newline at end of file \ No newline at end of file
@import "utils.scss"; @import "utils.scss";
@import "global.scss"; @import "global.scss";
@import "reset.scss";
// $defaultColor: #5850ff; // $defaultColor: #5850ff;
// $lightColor: #7973ff; // $lightColor: #7973ff;
...@@ -8,6 +9,7 @@ ...@@ -8,6 +9,7 @@
$defaultColor: $color-primary; $defaultColor: $color-primary;
$lightColor: $color-primary-light07; $lightColor: $color-primary-light07;
$dackColor: $color-primary-dark30; $dackColor: $color-primary-dark30;
$lightColorDisabled: $color-primary-light04;
//滚动条的公共样式 //滚动条的公共样式
.scrollbar-common { .scrollbar-common {
...@@ -47,9 +49,10 @@ $dackColor: $color-primary-dark30; ...@@ -47,9 +49,10 @@ $dackColor: $color-primary-dark30;
/* 按钮 */ /* 按钮 */
.el-button { .el-button {
padding: 12px 20px; padding: 12px 23px;
font-size: 14px; font-size: 14px;
border-radius: 4px; border-radius: 4px;
min-width: 76px;
} }
.el-button:hover, .el-button:hover,
.el-button:focus { .el-button:focus {
...@@ -64,7 +67,7 @@ $dackColor: $color-primary-dark30; ...@@ -64,7 +67,7 @@ $dackColor: $color-primary-dark30;
} }
.el-button.is-round { .el-button.is-round {
padding: 12px 20px; padding: 12px 23px;
} }
.el-button--primary { .el-button--primary {
color: #fff; color: #fff;
...@@ -76,24 +79,89 @@ $dackColor: $color-primary-dark30; ...@@ -76,24 +79,89 @@ $dackColor: $color-primary-dark30;
background: $dackColor; background: $dackColor;
border-color: $dackColor; border-color: $dackColor;
} }
.el-button--primary:focus, .el-button--primary:focus {
color: #fff;
background-color: $defaultColor;
border-color: $defaultColor;
}
.el-button--primary:hover { .el-button--primary:hover {
background: $lightColor; background: $lightColor;
border-color: $lightColor; border-color: $lightColor;
color: #fff; color: #fff;
} }
.el-button--text {
color: $defaultColor;
padding: 0px;
min-width: 0 !important;
}
.el-button--text:focus, .el-button--text:focus,
.el-button--text:hover { .el-button--text:hover {
color: $lightColor; color: $lightColor;
border-color: transparent; border-color: transparent;
background-color: transparent; background-color: transparent;
} }
.el-button--text:active {
color: $dackColor;
}
.el-button.is-disabled.el-button--text, .el-button.is-disabled.el-button--text:focus, .el-button.is-disabled.el-button--text:hover{
// border-color: $lightColorDisabled;
color: $lightColorDisabled;
}
// 文字链接
.el-button--text.btn-link:hover,.el-button--text.btn-link:active{
text-decoration:underline;
}
.el-button.is-disabled.el-button--text.btn-link, .el-button.is-disabled.el-button--text.btn-link:focus, .el-button.is-disabled.el-button--text.btn-link:hover{
text-decoration:underline;
}
.el-button.is-plain:focus, .el-button.is-plain:focus,
.el-button.is-plain:hover { .el-button.is-plain:hover {
background: #fff; background: transparent;
border-color: $lightColor; border-color: $lightColor;
color: $lightColor; color: $lightColor;
} }
.el-button.is-plain{
border-color: $defaultColor;
color: $defaultColor;
background: transparent;
}
.el-button.is-plain:active {
border-color: $dackColor;
color: $dackColor;
}
.el-button.is-disabled.is-plain, .el-button.is-disabled.is-plain:focus, .el-button.is-disabled.is-plain:hover{
border-color: $lightColorDisabled;
color: $lightColorDisabled;
background-color:transparent;
}
// 三级按钮样式 以is-plain为基础
.el-button.is-plain.btn-three{
border-color: #C8C8C8;
color: #666;
&:focus,&:hover {
opacity: 0.7;
}
&:active{
opacity: 1;
border-color: #484848;
color: #484848;
}
&.is-disabled{
opacity: 0.4;
border-color: #666;
color: #666;
&:focus,&:hover{
opacity: 0.4;
border-color: #666;
color: #666;
}
}
}
.el-button--primary.is-active, .el-button--primary.is-active,
.el-button--primary:active { .el-button--primary:active {
background: $dackColor; background: $dackColor;
...@@ -103,25 +171,52 @@ $dackColor: $color-primary-dark30; ...@@ -103,25 +171,52 @@ $dackColor: $color-primary-dark30;
.el-button--primary.is-plain{ .el-button--primary.is-plain{
background: #fff; background: #fff;
} }
.el-select .el-input__inner:focus { .el-select .el-input__inner:focus {
border-color: $dackColor; border-color: $dackColor;
} }
.el-button--small { .el-button--small {
padding: 8px 16px; padding: 8px 15px;
font-size: 14px; font-size: 14px;
border-radius: 4px; border-radius: 4px;
min-width: 60px;
} }
.el-button--small.is-round { .el-button--small.is-round {
padding: 8px 16px; padding: 8px 15px;
} }
.el-button--mini { .el-button--mini {
padding: 5px 10px; padding: 4px 7px;
font-size: 14px; font-size: 14px;
border-radius: 4px; border-radius: 4px;
min-width: 44px;
} }
.el-button--mini.is-round { .el-button--mini.is-round {
padding: 5px 10px; padding: 4px 7px;
}
.el-button--primary.is-disabled,
.el-button--primary.is-disabled:active,
.el-button--primary.is-disabled:focus,
.el-button--primary.is-disabled:hover {
// background-color: #e9e9e9;
// border-color: #e9e9e9;
// color: #a3a3a3;
background-color: $lightColorDisabled;
border-color: $lightColorDisabled;
color: #fff;
} }
// 按钮间距
.el-button+.el-button{
margin-left: 20px;
}
.el-button--mini+.el-button--mini{
margin-left: 12px;
}
.gap8+.gap8{
margin-left: 8px;
}
.el-dialog__title { .el-dialog__title {
font-size: 20px; font-size: 20px;
font-weight: 500; font-weight: 500;
...@@ -173,10 +268,7 @@ $dackColor: $color-primary-dark30; ...@@ -173,10 +268,7 @@ $dackColor: $color-primary-dark30;
.el-select .el-input.is-focus .el-input__inner { .el-select .el-input.is-focus .el-input__inner {
border-color: $defaultColor; border-color: $defaultColor;
} }
.el-button--text {
color: $defaultColor;
padding: 0px;
}
.el-select-dropdown__item.selected { .el-select-dropdown__item.selected {
color: $defaultColor; color: $defaultColor;
font-weight: bold; font-weight: bold;
...@@ -418,14 +510,7 @@ $dackColor: $color-primary-dark30; ...@@ -418,14 +510,7 @@ $dackColor: $color-primary-dark30;
.el-message-box__headerbtn:hover .el-message-box__close { .el-message-box__headerbtn:hover .el-message-box__close {
color: $defaultColor; color: $defaultColor;
} }
.el-button--primary.is-disabled,
.el-button--primary.is-disabled:active,
.el-button--primary.is-disabled:focus,
.el-button--primary.is-disabled:hover {
background-color: #e9e9e9;
border-color: #e9e9e9;
color: #a3a3a3;
}
/*弹框*/ /*弹框*/
.el-dialog__header { .el-dialog__header {
border-bottom: 1px solid #e6e6e6; border-bottom: 1px solid #e6e6e6;
...@@ -448,7 +533,7 @@ $dackColor: $color-primary-dark30; ...@@ -448,7 +533,7 @@ $dackColor: $color-primary-dark30;
border-color: $defaultColor; border-color: $defaultColor;
} }
.el-dialog__title { .el-dialog__title {
height: 30px; height: 27px;
display: block; display: block;
} }
.el-table--enable-row-hover .el-table__body tr:hover { .el-table--enable-row-hover .el-table__body tr:hover {
...@@ -466,27 +551,69 @@ $dackColor: $color-primary-dark30; ...@@ -466,27 +551,69 @@ $dackColor: $color-primary-dark30;
background: #f4f4fc; background: #f4f4fc;
} }
.el-message-box .el-message-box__title, //message box 之前小弹窗
.el-message-box{
vertical-align: baseline;
width: 576px;
padding-bottom: 0px;
}
.el-message-box .el-message-box__title{
font-size: 20px;
height: 27px;
}
.el-message-box .el-message-box__header{
padding: 16px 20px;
border-bottom: 1px solid #e6e6e6;
}
.el-message-box .el-message-box__headerbtn { .el-message-box .el-message-box__headerbtn {
display: none; font-size: 24px;
} }
.el-message-box__content { .el-message-box__content {
text-align: center; text-align: center;
padding: 50px 0px 50px; padding: 20px;
height: 152px;
} }
.el-message-box__status.el-icon-warning { .el-message-box__status.el-icon-warning {
display: none; // display: none;
} }
.el-message-box__btns { .el-message-box__btns {
text-align: center; text-align: center;
padding: 20px 0px 10px; padding: 15px 20px 16px;
border-top: 1px solid #e6e6e6; border-top: 1px solid #e6e6e6;
} }
.el-message-box__btns button:nth-child(1) {
border-color: #C8C8C8;
color: #666;
background-color: #fff;
&:focus,&:hover {
opacity: 0.7;
}
&:active{
opacity: 1;
border-color: #484848;
color: #484848;
}
&.is-disabled{
opacity: 0.4;
border-color: #666;
color: #666;
&:focus,&:hover{
opacity: 0.4;
border-color: #666;
color: #666;
}
}
}
.el-message-box__btns button:nth-child(2) { .el-message-box__btns button:nth-child(2) {
margin-left: 40px; margin-left: 20px;
}
.el-message-box__status{
left: 50%;
font-size: 48px !important;
transform: translate3d(-50%,-50%,0);
} }
.el-message-box__status + .el-message-box__message { .el-message-box__status+.el-message-box__message{
padding: 0px 10px; padding-top: 95px;
} }
// 气泡相关的样式调整 // 气泡相关的样式调整
...@@ -517,3 +644,22 @@ $dackColor: $color-primary-dark30; ...@@ -517,3 +644,22 @@ $dackColor: $color-primary-dark30;
@extend .scrollbar-common; @extend .scrollbar-common;
} }
} }
// this.$confirm样式
.gl-message-box {
.el-message-box__title {
line-height: 27px;
}
.el-message-box__headerbtn {
height: 100%;
top: 0;
}
.el-message-box__message {
p {
line-height: 22px;
}
}
.el-message-box__status+.el-message-box__message {
padding-top: 112.5px;
}
}
const emoji = [
['微笑', '撇嘴', '色', '发呆', '得意', '流泪', '害羞', '闭嘴'],
['睡', '大哭', '尴尬', '发怒', '调皮', '呲牙', '惊讶', '难过'],
['酷', '囧', '抓狂', '吐', '微笑', '愉快', '白眼', '傲慢'],
['饥饿', '困', '惊恐', '流汗', '憨笑', '大兵', '奋斗', '咒骂'],
['疑问', '嘘', '晕', '折磨', '衰', '骷髅', '敲打', '再见'],
['擦汗', '抠鼻', '鼓掌', '糗大了', '坏笑', '左哼哼', '右哼哼', '哈欠'],
['鄙视', '委屈', '快哭了', '阴险', '亲亲', '吓', '可怜', '菜刀'],
['西瓜', '啤酒', '篮球', '乒乓', '咖啡', '饭', '猪头', '玫瑰'],
['凋谢', '示爱', '爱心', '心碎', '蛋糕', '闪电', '炸弹', '刀'],
['足球', '瓢虫', '便便', '月亮', '太阳', '礼物', '拥抱', '强'],
['弱', '握手', '胜利', '抱拳', '勾引', '拳头', '差劲', '爱你'],
['NO', 'OK', '爱情', '飞吻', '跳跳', '发抖', '怄火', '转圈'],
['磕头', '回头', '跳绳', '投降', '挥手', '激动', '街舞', '左太极'],
['右太极', '嘿哈', '捂脸', '奸笑', '机智', '皱眉', '耶', '社会社会'],
['让我看看', '666', '红包', '蜡烛', '烟花', '福', '庆祝', '爆竹']
]
export default emoji
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!