vue3仿windows弹窗

 

一款基于vue3的仿windows弹窗。 可以组件模板编写或函数式创建。地址:https://github.com/dnoyeb/box-win

 

 

 

安装

1
npm add 'box-win'

  

两种方式:

1、组件式引入

1
2
3
4
5
6
7
8
9
10
11
12
//全局 test为自定义组件
import BoxWin from 'box-win'
app.use(BoxWin)
//或局部引入
import { BoxWin } from 'box-win'
 
<BoxWin v-model="box1" position="center" :title="'box1'">
    <template #body>
        我是内容区域
        <test :test="666" />
    </template>
</BoxWin>

  

2、函数式创建

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//test为自定义组件
import { boxWin } from 'box-win'
 
boxWin.createBoxWin({
    position: 'center',
    bodyStyle: { background: 'blue' },
    headIcon: h(test, {
      test: 111
    }),
    title: '标题',
    body: h(test, {
      test: 333
    }),
    headControl: h(test, {
      test: 444
    }),
})

  

配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
props参数:
 
    modelValue?: boolean //普通引入控制显示
    title?: string,
    width?: string; // 默认宽 —— 设置头高 宽高最好传入变量
    height?: string; // 默认高
    top?: string; // 默认距离上
    left?: string; // 默认距离左
    position?: string; // 默认比top、left优先,暂时支持center
    animate?: boolean; //是否需要动画
    duration?: number,//动画时间,单位 s
    headHeight?: string; // 默认控制栏高
    headStyle?: Record<string, any>; // 控制栏样式
    bodyStyle?: Record<string, any>; //主要内容区域样式
    resizeAble?: boolean | string; // 是否可以调整尺寸 默认可以调整
    dragAble?: boolean | string; // 是否可以拖拽 默认可拖拽
    minShow?: boolean; // 全屏控制显示 默认显示
    maxShow?: boolean; // 全屏控制显示 默认显示
    fullShow?: boolean; // 全屏控制显示 默认显示
    closeShow?: boolean; // 关闭控制显示 默认显示
    headIcon?: Slots | HTMLElement,
    headTitle?: Slots | HTMLElement,
    headControl?: Slots | HTMLElement,
    body?: Slots | HTMLElement,
 
响应事件:
 
    'update:modelValue',
    'fullscreen',
    'exitFullscreen',
    'max', 'restore',
    'min',
    'close'

  

posted @   dnoyeb  阅读(446)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 张高兴的大模型开发实战:(一)使用 Selenium 进行网页爬虫
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
历史上的今天:
2019-03-14 flutter图片铺满父框
2019-03-14 dart正则
2019-03-14 Flutter的输入框TextField
2019-03-14 Flutter路由管理
点击右上角即可分享
微信分享提示