hPopup.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <!--弹出层 -->
  3. <view class="hPopup animate posi-fixed" :class="(is_show || forbidden_event) ?'dis-none dis-block':' dis-none'">
  4. <div class="wrap posi-fixed"
  5. @tap.stop.prevent="hide()"
  6. :style="{top:h_global.getStatusBarHeight('px')}">
  7. <div class="inner animated fast" :class="animate_class" @tap.stop>
  8. <slot></slot>
  9. </div>
  10. </div>
  11. </view>
  12. </template>
  13. <script>
  14. export default {
  15. name: "hPopup",
  16. data() {
  17. return {
  18. animate:'',
  19. is_show:false
  20. }
  21. },
  22. computed:{
  23. /*动画的名字 依托于animatecss*/
  24. animate_class(){
  25. let mode = this.mode;
  26. let animate_obj = {
  27. left:'fadeInLeftBig',
  28. top:'fadeInDownBig',
  29. right:'fadeInRightBig',
  30. bottom:'fadeInUpBig',
  31. center:'fadeIn',
  32. }
  33. return animate_obj[mode]
  34. },
  35. },
  36. props:{
  37. mode:{
  38. default:'center',//top / right / bottom / center//left
  39. },
  40. forbidden_event:{
  41. default:false,//禁用事件
  42. }
  43. },
  44. methods: {
  45. show(){
  46. if(this.forbidden_event){
  47. return false;
  48. }
  49. this.is_show = true;
  50. this.$emit('popupShow',{})
  51. },
  52. hide(){
  53. if(this.forbidden_event){
  54. return false;
  55. }
  56. this.is_show = false;
  57. this.$emit('popupHide',{})
  58. }
  59. },
  60. mounted(){
  61. }
  62. }
  63. </script>
  64. <style scoped lang="scss">
  65. .wrap{
  66. background: rgba(0, 0, 0, 0.59);
  67. z-index: 9999;
  68. }
  69. </style>
  70. 评论 ( 0 )