index.vue 1.2KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <template>
  2. <uni-shadow-root class="vant-overlay-index"><van-transition :show="show" custom-class="van-overlay" :custom-style="'z-index: '+(zIndex)+'; '+(mask ? 'background-color: rgba(0, 0, 0, .7);' : '')+'; '+(customStyle)" :duration="duration" @click.native="onClick" @touchmove.native.stop.prevent="noop"></van-transition></uni-shadow-root>
  3. </template>
  4. <script>
  5. import VanTransition from '../transition/index.vue'
  6. global['__wxVueOptions'] = {components:{'van-transition': VanTransition}}
  7. global['__wxRoute'] = 'vant/overlay/index'
  8. import { VantComponent } from '../common/component';
  9. VantComponent({
  10. props: {
  11. show: Boolean,
  12. mask: Boolean,
  13. customStyle: String,
  14. duration: {
  15. type: [Number, Object],
  16. value: 300
  17. },
  18. zIndex: {
  19. type: Number,
  20. value: 1
  21. }
  22. },
  23. methods: {
  24. onClick() {
  25. this.$emit('click');
  26. },
  27. // for prevent touchmove
  28. noop() { }
  29. }
  30. });
  31. export default global['__wxComponents']['vant/overlay/index']
  32. </script>
  33. <style platform="mp-weixin">
  34. @import '../common/index.css';.van-overlay{position:fixed;top:0;right:0;bottom:0;left:0}
  35. </style>