index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <uni-shadow-root class="weapp-lib-share-sheet-index"><van-popup round class="van-share-sheet" :show="show" position="bottom" :overlay="overlay" :duration="duration" :z-index="zIndex" :overlay-style="overlayStyle" :close-on-click-overlay="closeOnClickOverlay" :safe-area-inset-bottom="safeAreaInsetBottom" @close="onClose" @click-overlay="onClickOverlay">
  3. <view class="van-share-sheet__header">
  4. <view class="van-share-sheet__title">
  5. <slot name="title"></slot>
  6. </view>
  7. <view v-if="title" class="van-share-sheet__title">{{ title }}</view>
  8. <view class="van-share-sheet__description">
  9. <slot name="description"></slot>
  10. </view>
  11. <view v-if="description" class="van-share-sheet__description">
  12. {{ description }}
  13. </view>
  14. </view>
  15. <block v-if="computed.isMulti(options)">
  16. <options v-for="(item,index) in (options)" :key="item.index" :show-border="index !== 0" :options="item" @select="onSelect"></options>
  17. </block>
  18. <options v-else :options="options" @select="onSelect"></options>
  19. <button type="button" class="van-share-sheet__cancel" @click="onCancel">
  20. {{ cancelText }}
  21. </button>
  22. </van-popup></uni-shadow-root>
  23. </template>
  24. <wxs src="./index.wxs" module="computed"></wxs>
  25. <script>
  26. import VanPopup from '../popup/index.vue'
  27. import Options from './options.vue'
  28. global['__wxVueOptions'] = {components:{'van-popup': VanPopup,'options': Options}}
  29. global['__wxRoute'] = 'weapp/lib/share-sheet/index'
  30. "use strict";
  31. Object.defineProperty(exports, "__esModule", { value: true });
  32. var component_1 = require("../common/component");
  33. (0, component_1.VantComponent)({
  34. props: {
  35. // whether to show popup
  36. show: Boolean,
  37. // overlay custom style
  38. overlayStyle: String,
  39. // z-index
  40. zIndex: {
  41. type: Number,
  42. value: 100,
  43. },
  44. title: String,
  45. cancelText: {
  46. type: String,
  47. value: '取消',
  48. },
  49. description: String,
  50. options: {
  51. type: Array,
  52. value: [],
  53. },
  54. overlay: {
  55. type: Boolean,
  56. value: true,
  57. },
  58. safeAreaInsetBottom: {
  59. type: Boolean,
  60. value: true,
  61. },
  62. closeOnClickOverlay: {
  63. type: Boolean,
  64. value: true,
  65. },
  66. duration: {
  67. type: null,
  68. value: 300,
  69. },
  70. },
  71. methods: {
  72. onClickOverlay: function () {
  73. this.$emit('click-overlay');
  74. },
  75. onCancel: function () {
  76. this.onClose();
  77. this.$emit('cancel');
  78. },
  79. onSelect: function (event) {
  80. this.$emit('select', event.detail);
  81. },
  82. onClose: function () {
  83. this.$emit('close');
  84. },
  85. },
  86. });
  87. export default global['__wxComponents']['weapp/lib/share-sheet/index']
  88. </script>
  89. <style platform="mp-weixin">
  90. @import '../common/index.css';.van-share-sheet__header{padding:12px 16px 4px;text-align:center}.van-share-sheet__title{color:#323233;font-size:14px;font-weight:400;line-height:20px;margin-top:8px}.van-share-sheet__title:empty,.van-share-sheet__title:not(:empty)+.van-share-sheet__title{display:none}.van-share-sheet__description{color:#969799;display:block;font-size:12px;line-height:16px;margin-top:8px}.van-share-sheet__description:empty,.van-share-sheet__description:not(:empty)+.van-share-sheet__description{display:none}.van-share-sheet__cancel{background:#fff;border:none;box-sizing:initial;display:block;font-size:16px;height:auto;line-height:48px;padding:0;text-align:center;width:100%}.van-share-sheet__cancel:before{background-color:#f7f8fa;content:" ";display:block;height:8px}.van-share-sheet__cancel:after{display:none}.van-share-sheet__cancel:active{background-color:#f2f3f5}
  91. </style>