0.0.6 • Published 10 months ago
v3-emoonui v0.0.6
eMoonUI
基于vue3的组件库
安装
- 下载库
npm install v3-emoonui -D
- 更新库
npm install v3-emoonui@latest
- 全局引入
import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import eMoonUI from 'v3-emoonui'
import 'v3-emoonui/es/style.css'
createApp(App).use(eMoonUI).mount('#app')
eMoonDialog组件
弹窗组件 支持拖拽-缩放-窗口化-全屏
- 使用示例
<script setup lang="ts">
import { reactive } from 'vue'
const dialog = reactive({
config: {
visible: false,
},
open() {
dialog.config.visible = true
},
close() {
dialog.config.visible = false
}
})
</script>
<template>
<ul>
<li><button @click="dialog.open">显示弹窗</button></li>
<li><button @click="dialog.close">隐藏弹窗</button></li>
</ul>
<eMoonDialog title="标题1" v-model:visible="dialog.config.visible" @close="dialog.close">
内容
</eMoonDialog>
</template>
- 属性
属性 | 含义 | 值类型 | 默认值 | 备注 |
---|---|---|---|---|
parentElement | 父级元素的引用 | String | '' | document.querySelector方法引用的格式 |
minWidth | 最小宽度 | Number | 500 | 最小值为200 |
minHeight | 最小高度 | Number | 44 | 最小值为44 |
width | 宽度 | Number,String(xx%,xx) | 50% | 值为 xx% 和xx 表示百分比数 |
height | 高度 | Number,String(auto,xx%,xx) | 50% | 值为auto 时表示自适应高度, xx% 和xx 表示百分比数 |
title | 弹窗标题 | String | '' | |
left | 左侧定位值 | Number,undefined | undefined | 只能为大于0的数值或undefined |
top | 顶部定位值 | Number,undefined | undefined | 只能为大于0的数值或undefined |
visible | 是否显示弹窗 | Boolean | false | |
draggable | 是否可以拖拽 | Boolean | true | |
resize | 是否可以改变大小 | Boolean | true | |
showClose | 显示关闭按钮 | Boolean | true | |
showWindow | 显示窗口按钮 | Boolean | true | |
showScreen | 显示全屏按钮 | Boolean | true | |
beforeClose | 关闭前的钩子函数 | Function | (done: Function): void => {done();} | |
dialogHeaderClassName | 弹窗头部class类名 | String | '' | |
dialogContentClassName | 弹窗内容class类名 | String | '' | |
dialogFooterClassName | 弹窗脚注class类名 | String | '' |
- emit方法
方法名 | 作用 | 附带值 |
---|---|---|
close | 关闭弹窗 | 无 |
update:visible | 改变visible值 | Boolean |
- css变量
变量名 | 默认值 |
---|---|
--dialog-mask-bgcolor | transparent |
--dialog-header-bgcolor | #fff |
--dialog-header-color | #333 |
--dialog-header-border-bottom | 1px solid #cccccc20 |
--dialog-content-bgcolor | #fff |
--dialog-content-color | #333 |
--dialog-content-scrollbar-bg-color | transparent |
--dialog-content-scrollbar-color | #888888 |
--dialog-footer-border-top | 1px solid #cccccc20 |
--dialog-footer-text-align | end |
--dialog-footer-bgcolor | #fff |
--dialog-footer-color | #333 |
--dialog-border-color | purple |
--dialog-border-width | 3px |
--dialog-border-height | 3px |