vue电脑版怎么安装(vlog电脑剪辑软件教程)

来源:国外服务器 在您之前已被浏览:1 次
导读:目前正在解读《vue电脑版怎么安装(vlog电脑剪辑软件教程)》的相关信息,《vue电脑版怎么安装(vlog电脑剪辑软件教程)》是由用户自行发布的知识型内容!下面请观看由(国外主机 - www.2bp.net)用户发布《vue电脑版怎么安装(vlog电脑剪辑软件教程)》的详细说明。
笨笨网美国主机,w ww.2 b p .n e t

今天给大家分享的是Vue3系列之自定义桌面端对话框组件v3layer。

vue电脑版怎么安装(vlog电脑剪辑软件教程)


V3Layer 基于vue3.0构建的多功能PC网页端弹窗组件。拥有超过10+种弹窗类型、30+种参数配置,支持拖拽(自定义拖拽区域)、缩放、最大化、全屏及自定义置顶层叠等功能。

vue电脑版怎么安装(vlog电脑剪辑软件教程)


快速引入

在main.js中引入v3layer组件。

import { createApp } from 'vue'import App from './App.vue'// 引入Element-Plus组件库import ElementPlus from 'element-plus'import 'element-plus/lib/theme-chalk/index.css'// 引入弹窗组件v3layerimport V3Layer from './components/v3layer'createApp(App).use(ElementPlus).use(V3Layer).mount('#app')

vue电脑版怎么安装(vlog电脑剪辑软件教程)


v3layer支持组件式+函数式两种调用方式。

组件式

<v3-layer v-model="showDialog" title="标题内容" content="<div style='color:#f57b16;padding:30px;'>这里是内容信息!</div>" z-index="2021" lockScroll="false" xclose resize dragOut :btns="[ {text: '取消', click: () => showDialog=false}, {text: '确认', style: 'color:#f90;', click: handleSure}, ]"/> <template v-slot:content>这里是自定义插槽内容信息!</template></v3-layer>

函数式

let $el = v3layer({ title: '标题内容', content: '<div style='color:#f57b16;padding:30px;'>这里是内容信息!</div>', shadeClose: false, zIndex: 2021, lockScroll: false, xclose: true, resize: true, dragOut: true, btns: [ {text: '取消', click: () => { $el.close() }}, {text: '确认', click: () => handleSure}, ]});

当弹窗类型为 message | notify | popover,调用方法如下:

v3layer.message({...})v3layer.notify({...})v3layer.popover({...})

vue电脑版怎么安装(vlog电脑剪辑软件教程)


vue3.0中提供了

app.config.globalProperties 或 app.provide 两种方式挂载全局函数。

如果是 app.config.globalProperties 方式创建:

// vue2中调用methods: { showDialog() { this.$v3layer({...}) }}// vue3中调用setup() { // 获取上下文 const { ctx } = getCurrentInstance() ctx.$v3layer({...})}

如果是 app.provide 方式创建:

// vue2中调用methods: { showDialog() { this.v3layer({...}) }}// vue3中调用setup() { const v3layer = inject('v3layer') const showDialog = () => { v3layer({...}) } return { v3layer, showDialog }}

vue电脑版怎么安装(vlog电脑剪辑软件教程)
vue电脑版怎么安装(vlog电脑剪辑软件教程)
vue电脑版怎么安装(vlog电脑剪辑软件教程)
vue电脑版怎么安装(vlog电脑剪辑软件教程)
vue电脑版怎么安装(vlog电脑剪辑软件教程)
vue电脑版怎么安装(vlog电脑剪辑软件教程)
vue电脑版怎么安装(vlog电脑剪辑软件教程)
vue电脑版怎么安装(vlog电脑剪辑软件教程)
vue电脑版怎么安装(vlog电脑剪辑软件教程)


参数配置

v3layer支持如下30+参数灵活配置,实现各种弹窗场景。

|props参数|v-model 是否显示弹框id 弹窗唯一标识title 标题content 内容(支持String、带标签内容、自定义插槽内容)***如果content内容比较复杂,推荐使用标签式写法type 弹框类型(toast|footer|actionsheet|actionsheetPicker|android|ios|contextmenu|drawer|iframe)layerStyle 自定义弹窗样式icon toast图标(loading | success | fail)shade 是否显示遮罩层shadeClose 是否点击遮罩时关闭弹窗lockScroll 是否弹窗出现时将body滚动锁定opacity 遮罩层透明度xclose 是否显示关闭图标xposition 关闭图标位置(left | right | top | bottom)xcolor 关闭图标颜色anim 弹窗动画(scaleIn | fadeIn | footer | fadeInUp | fadeInDown | fadeInLeft | fadeInRight)position 弹出位置(auto | ['100px','50px'] | t | r | b | l | lt | rt | lb | rb)drawer 抽屉弹窗(top | right | bottom | left)follow 跟随元素定位弹窗(支持元素.kk #kk 或 [e.clientX, e.clientY])time 弹窗自动关闭秒数(1、2、3)zIndex 弹窗层叠(默认8080)teleport 指定挂载节点(默认是挂载组件标签位置,可通过teleport自定义挂载位置) teleport="body | #xxx | .xxx"topmost 置顶当前窗口(默认false)area 弹窗宽高(默认auto)设置宽度area: '300px' 设置高度area:['', '200px'] 设置宽高area:['350px', '150px']maxWidth 弹窗最大宽度(只有当area:'auto'时,maxWidth的设定才有效)maximize 是否显示最大化按钮(默认false)fullscreen 全屏弹窗(默认false)fixed 弹窗是否固定drag 拖拽元素(可定义选择器drag:'.xxx' | 禁止拖拽drag:false)dragOut 是否允许拖拽到窗口外(默认false)lockAxis 限制拖拽方向可选: v 垂直、h 水平,默认不限制resize 是否允许拉伸尺寸(默认false)btns 弹窗按钮(参数:text|style|disabled|click)++++++++++++++++++++++++++++++++++++++++++++++|emit事件触发|success 层弹出后回调(@success="xxx")end 层销毁后回调(@end="xxx")++++++++++++++++++++++++++++++++++++++++++++++|event事件|onSuccess 层打开回调事件onEnd 层关闭回调事件

v3layer弹窗模板

<template> <div ref="elRef" v-show="opened" class="vui__layer" :class="{'vui__layer-closed': closeCls}" :id="id"> <!-- //蒙版 --> <div v-if="JSON.parse(shade)" class="vlayer__overlay" @click="shadeClicked" :style="{opacity}"></div> <div class="vlayer__wrap" :class="['anim-'+anim, type&&'popui__'+type, tipArrow]" :style="[layerStyle]"> <div v-if="title" class="vlayer__wrap-tit" v-html="title"></div> <div v-if="type=='toast'&&icon" class="vlayer__toast-icon" :class="['vlayer__toast-'+icon]" v-html="toastIcon[icon]"></div> <div class="vlayer__wrap-cntbox"> <!-- 判断插槽是否存在 --> <template v-if="$slots.content"> <div class="vlayer__wrap-cnt"><slot name="content" /></div> </template> <template v-else> <template v-if="content"> <iframe v-if="type=='iframe'" scrolling="auto" allowtransparency="true" frameborder="0" :src=https://www.2bp.net/wp-content/uploads/2021/08/bf78e9fe20bd479d9a6136502f98db7c.png alt=vue3.0系列:Vue3自定义PC端弹窗组件V3Layer>

vue电脑版怎么安装(vlog电脑剪辑软件教程)


ok,基于vue3.0开发pc端对话框组件就分享到这里。希望对大家有所帮助哈!

笨笨网美国主机,w ww.2 b p .n e t
提醒:《vue电脑版怎么安装(vlog电脑剪辑软件教程)》最后刷新时间 2025-03-21 11:16:30,本站为公益型个人网站,仅供个人学习和记录信息,不进行任何商业性质的盈利。如果内容、图片资源失效或内容涉及侵权,请反馈至,我们会及时处理。本站只保证内容的可读性,无法保证真实性,《vue电脑版怎么安装(vlog电脑剪辑软件教程)》该内容的真实性请自行鉴别。