uv-ui
Version:
基于vue3的移动端组件库
2 lines (1 loc) • 2.72 kB
JavaScript
"use strict";const e=require("vue"),r=require("../icon/index.cjs"),p=require("../overlay/index.cjs");require("./popup.vue_vue_type_style_index_0_lang.cjs");const v={class:"uv-popup-content"},f={key:0,class:"uv-popup-content-top"},m={key:0,class:"uv-popup-content-title"},y={key:1,class:"uv-popup-content-close"},h={class:"uv-popup-content-item"},k={key:1,class:"uv-popup-content-button"},g=["onClick"],V=["onClick"],C={name:"UvPopup"},B=Object.assign(C,{props:{modelValue:{type:Boolean,default:!1},position:{type:String,default:"bottom"},bgColor:{type:String,default:"#fff"},round:{type:Boolean,default:!1},padding:{type:Boolean,default:!0},overlay:{type:Boolean,default:!0},clickOverlayClose:{type:Boolean,default:!0},height:{type:String,default:"auto"},action:{type:Boolean,default:!1},title:{type:String,default:""},close:{type:Boolean,default:!1},leftName:{type:String,default:"\u53D6\u6D88"},rightName:{type:String,default:"\u786E\u5B9A"}},emits:["update:modelValue","cancle","confim","close"],setup(t,{emit:o}){const n=t,c=e.computed(()=>["uv-popup-wrap",n.position?`uv-popup-${n.position}`:"",n.round?`uv-popup-${n.position}-round`:""]),a=()=>{n.clickOverlayClose&&o("update:modelValue",!1)},i=()=>{o("cancle"),o("update:modelValue",!1)},s=()=>{o("confim")},u=()=>{o("close"),o("update:modelValue",!1)};return(d,l)=>(e.openBlock(),e.createElementBlock("div",{class:"uv-popup",onTouchmove:l[0]||(l[0]=e.withModifiers(()=>{},["prevent"]))},[e.createVNode(e.unref(p),{overlay:t.overlay,show:t.modelValue,onClick:a},null,8,["overlay","show"]),e.createVNode(e.Transition,{name:"uv-popup-slide-"+t.position},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(e.unref(c)),style:e.normalizeStyle({height:t.height,backgroundColor:t.bgColor,padding:t.padding?"10px":"none"})},[e.createElementVNode("div",v,[t.title||t.close?(e.openBlock(),e.createElementBlock("div",f,[t.title?(e.openBlock(),e.createElementBlock("div",m,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),t.close?(e.openBlock(),e.createElementBlock("div",y,[e.createVNode(e.unref(r),{onClick:u,name:"close",size:"28",color:"#c8c9cc"})])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",h,[e.renderSlot(d.$slots,"default")]),t.action?(e.openBlock(),e.createElementBlock("div",k,[e.createElementVNode("div",{class:"uv-popup-content-button-cancle",onClick:e.withModifiers(i,["stop"])},e.toDisplayString(t.leftName),9,g),e.createElementVNode("div",{class:"uv-popup-content-button-confim",onClick:e.withModifiers(s,["stop"])},e.toDisplayString(t.rightName),9,V)])):e.createCommentVNode("",!0)])],6),[[e.vShow,t.modelValue]])]),_:3},8,["name"])],32))}});module.exports=B;