2 lines
6.8 KiB
JavaScript
2 lines
6.8 KiB
JavaScript
![]() |
import{_ as t}from"./uv-overlay.28e9addc.js";import{Y as e,Z as o,o as s,j as i,m as a,y as n,B as r,G as l,H as p,E as h,w as u,h as d,z as c,a0 as m,Q as f}from"./index-d4baa715.js";import{_ as y}from"./uv-status-bar.c500a724.js";import{_ as g}from"./_plugin-vue_export-helper.1b428a4d.js";import{_ as b}from"./uv-icon.b5ddbe11.js";import{_ as v}from"./uv-transition.e8fc5cb3.js";const k=g({name:"uv-safe-bottom",mixins:[e,o],data:()=>({safeAreaBottomHeight:0,isNvue:!1}),computed:{style(){return this.$uv.deepMerge({},this.$uv.addStyle(this.customStyle))}},mounted(){}},[["render",function(t,e,o,l,p,h){const u=r;return s(),i(u,{class:a(["uv-safe-bottom",[!p.isNvue&&"uv-safe-area-inset-bottom"]]),style:n([h.style])},null,8,["style","class"])}],["__scopeId","data-v-e97e85dd"]]);const w=g({name:"uv-popup",components:{keypress:{name:"Keypress",props:{disable:{type:Boolean,default:!1}},mounted(){const t={esc:["Esc","Escape"],tab:"Tab",enter:"Enter",space:[" ","Spacebar"],up:["Up","ArrowUp"],left:["Left","ArrowLeft"],right:["Right","ArrowRight"],down:["Down","ArrowDown"],delete:["Backspace","Delete","Del"]};document.addEventListener("keyup",(e=>{if(this.disable)return;const o=Object.keys(t).find((o=>{const s=e.key,i=t[o];return i===s||Array.isArray(i)&&i.includes(s)}));o&&setTimeout((()=>{this.$emit(o,{})}),0)}))},render:()=>{}}},mixins:[e,o],emits:["change","maskClick"],props:{mode:{type:String,default:"center"},duration:{type:[String,Number],default:300},zIndex:{type:[String,Number],default:10075},bgColor:{type:String,default:"#ffffff"},safeArea:{type:Boolean,default:!0},overlay:{type:Boolean,default:!0},closeOnClickOverlay:{type:Boolean,default:!0},overlayOpacity:{type:[Number,String],default:.4},overlayStyle:{type:[Object,String],default:""},safeAreaInsetBottom:{type:Boolean,default:!0},safeAreaInsetTop:{type:Boolean,default:!1},closeable:{type:Boolean,default:!1},closeIconPos:{type:String,default:"top-right"},zoom:{type:Boolean,default:!0},round:{type:[Number,String],default:0}},watch:{type:{handler:function(t){this.config[t]&&this[this.config[t]](!0)},immediate:!0},isDesktop:{handler:function(t){this.config[t]&&this[this.config[this.mode]](!0)},immediate:!0},showPopup(t){document.getElementsByTagName("body")[0].style.overflow=t?"hidden":"visible"}},data(){return{ani:[],showPopup:!1,showTrans:!1,popupWidth:0,popupHeight:0,config:{top:"top",bottom:"bottom",center:"center",left:"left",right:"right",message:"top",dialog:"center",share:"bottom"},transitionStyle:{position:"fixed",left:0,right:0},maskShow:!0,mkclick:!0,popupClass:this.isDesktop?"fixforpc-top":"top"}},computed:{isDesktop(){return this.popupWidth>=500&&this.popupHeight>=500},bg(){return""===this.bgColor||"none"===this.bgColor||this.$uv.getPx(this.round)>0?"transparent":this.bgColor},contentStyle(){const t={};if(this.bgColor&&(t.backgroundColor=this.bg),this.round){const e=this.$uv.addUnit(this.round);t.backgroundColor=this.bgColor,"top"===this.mode?(t.borderBottomLeftRadius=e,t.borderBottomRightRadius=e):"bottom"===this.mode?(t.borderTopLeftRadius=e,t.borderTopRightRadius=e):"center"===this.mode&&(t.borderRadius=e)}return this.$uv.deepMerge(t,this.$uv.addStyle(this.customStyle))}},unmounted(){this.setH5Visible()},created(){this.messageChild=null,this.clearPropagation=!1},methods:{setH5Visible(){document.getElementsByTagName("body")[0].style.overflow="visible"},closeMask(){this.maskShow=!1},clear(t){t.stopPropagation(),this.clearPropagation=!0},open(t){if(this.showPopup)return;if(t&&-1!==["top","center","bottom","left","right","message","dialog","share"].indexOf(t)||(t=this.mode),!this.config[t])return this.$uv.error(`缺少类型:${t}`);this[this.config[t]](),this.$emit("change",{show:!0,type:t})},close(t){this.showTrans=!1,this.$emit("change",{show:!1,type:this.mode}),clearTimeout(this.timer),this.timer=setTimeout((()=>{this.showPopup=!1}),300)},touchstart(){this.clearPropagation=!1},onTap(){this.clearPropagation?this.clearPropagation=!1:(this.$emit("maskClick"),this.closeOnClickOverlay&&this.close())},top(t){this.popupClass=this.isDesktop?"fixforpc-top":"top",th
|