123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225 |
- <style>
- .jcPopUp{
- top:0;
- left: 0;
- width: 100%;
- height: 100%;
- position: fixed;
- z-index:9999;
- }
- .jcPopUp-mark{
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- z-index:9997;
- position: absolute;
- background: rgba(0,0,0,0.5);
- }
- .jcPopUp-content{
- width:100%;
- height:100%;
- top:0;
- left:0;
- position: absolute;
- z-index:9998;
- }
- .st{
- animation: showTop 0.25s;
- }
- .sl{
- animation: showLeft 0.25s;
- }
- .sr{
- animation: showRight 0.25s;
- }
- .sb{
- animation: shoBottom 0.25s;
- }
- .ht{
- animation: hideTop 0.25s;
- }
- .hl{
- animation: hideLeft 0.25s;
- }
- .hr{
- animation: hideRight 0.25s;
- }
- .hb{
- animation: hideBottom 0.25s;
- }
- @keyframes showTop{
- from {
- transform: translateY(-100%);
- }
- to {
- transform: translateY(0);
- }
- }
- @keyframes showLeft{
- from {
- transform: translateX(-100%);
- }
- to {
- transform: translateY(0);
- }
- }
- @keyframes showRight{
- from {
- transform: translateX(100%);
- }
- to {
- transform: translateX(0);
- }
- }
- @keyframes showBottom{
- from {
- transform: translateY(100%);
- }
- to {
- transform: translateY(0);
- }
- }
- @keyframes hideTop{
- from {
- transform: translateY(0);
- }
- to {
- transform: translateY(-100%);
- }
- }
- @keyframes hideLeft{
- from {
- transform: translateY(0);
- }
- to {
- transform: translateX(-100%);
- }
- }
- @keyframes hideRight{
- from {
- transform: translateX(0);
- }
- to {
- transform: translateX(100%);
- }
- }
- @keyframes hideBottom{
- from {
- transform: translateY(0);
- }
- to {
- transform: translateY(100%);
- }
- }
- </style>
-
- <template name="jc-popUp">
- <view class="jcPopUp" v-show="popshow" @click.stop="" v-if="markMove=='false'" @touchmove.stop="">
- <view class="jcPopUp-mark"></view>
- <view class="jcPopUp-content" @tap="markTap" :class="position=='top'&&!hideanimation?'st':position=='left'&&!hideanimation?'sl':position=='right'&&!hideanimation?'sr':position=='bottom'&&!hideanimation?'sb':position=='top'&&hideanimation?'ht':position=='left'&&hideanimation?'hl':position=='right'&&hideanimation?'hr':position=='bottom'&&hideanimation?'hb':''">
- <view style="z-index:1000000;" @tap.stop="">
- <slot></slot>
- </view>
- <icon type="clear" :size="iconSize" color="#FFFFFF" style="position:absolute;" :style="'left:'+iconLeft+'%;top:'+iconTop+'%;'" v-if="closeIcon=='true'" @tap="iconTap"/>
- </view>
- </view>
- <view class="jcPopUp" v-show="popshow" @click.stop="" @tap.stop="" v-else="">
- <view class="jcPopUp-mark"></view>
- <view class="jcPopUp-content" @tap="markTap" :class="position=='top'&&!hideanimation?'st':position=='left'&&!hideanimation?'sl':position=='right'&&!hideanimation?'sr':position=='bottom'&&!hideanimation?'sb':position=='top'&&hideanimation?'ht':position=='left'&&hideanimation?'hl':position=='right'&&hideanimation?'hr':position=='bottom'&&hideanimation?'hb':''">
- <view style="z-index:1000000;" @tap.stop="">
- <slot></slot>
- </view>
- <icon type="clear" :size="iconSize" color="#FFFFFF" style="position:absolute;" :style="'left:'+iconLeft+'%;top:'+iconTop+'%;'" v-if="closeIcon=='true'" @tap="iconTap"/>
- </view>
- </view>
- </template>
- <script>
- export default {
- props:{
- position:{
- type:String,
- default:""
- },
- markTapHide:{
- type:String,
- default:''
- },
- markMove:{
- type:String,
- default:'false'
- },
- closeIcon:{
- type:String,
- default:''
- },
- iconSize:{
- type:String,
- default:'26'
- },
- iconTop:{
- type:String,
- default:'0'
- },
- iconLeft:{
- type:String,
- default:'0'
- }
- },
- data() {
- return {
- popshow:false,
- hideanimation:false
- };
- },
- methods:{
- show(){
- this.popshow = true;
- },
- hide(){
- let that = this;
- that.hideanimation = true;
- if(that.position==null){
- that.popshow = false;
- }else{
- setTimeout(function(){
- that.popshow = false;
- that.hideanimation = false;
- },250)
- };
- },
- markTap(){
- let that = this;
- if(that.markTapHide != 'true'){
- return false
- };
- that.hideanimation = true;
- if(that.position==null){
- that.popshow = false;
- }else{
- setTimeout(function(){
- that.popshow = false;
- that.hideanimation = false;
- },250)
- };
- },
- iconTap(){
- let that = this;
- if(that.closeIcon != 'true'){
- return false
- };
- that.hideanimation = true;
- if(that.position==null){
- that.popshow = false;
- }else{
- setTimeout(function(){
- that.popshow = false;
- that.hideanimation = false;
- },250)
- };
- }
- },
- }
- </script>
|