index.vue 1.1 KB

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