share-action-sheet.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <script setup lang="ts">
  2. import timeline from '@designer-hub/assets/src/libs/assets/timeline'
  3. import wechat from '@designer-hub/assets/src/libs/assets/wechat'
  4. const modelValue = defineModel({
  5. default: false,
  6. type: Boolean,
  7. })
  8. const props = withDefaults(
  9. defineProps<{
  10. options?: any
  11. }>(),
  12. {},
  13. )
  14. const emits = defineEmits<{ select: [action: string | 'share' | 'timeline'] }>()
  15. const actions = [
  16. { icon: wechat, title: '微信好友', value: 'share' },
  17. { icon: timeline, title: '朋友圈', value: 'timeline' },
  18. ]
  19. const handleAction = (it: { value: string }) => {
  20. modelValue.value = false
  21. emits('select', it.value)
  22. }
  23. </script>
  24. <template>
  25. <wd-action-sheet v-model="modelValue" title="分享到" @close="modelValue = false">
  26. <view class="" style="">
  27. <div class="flex justify-around">
  28. <template v-for="(it, index) in actions" :key="index">
  29. <button :open-type="it.value" :data-options="options">
  30. <div class="flex flex-col items-center gap-2" @click="handleAction(it)">
  31. <div class="w-12 h-12 relative">
  32. <wd-img width="100%" height="100%" :src="it.icon"></wd-img>
  33. </div>
  34. <div class="text-black/60 text-xs font-normal font-['PingFang_SC'] leading-relaxed">
  35. {{ it.title }}
  36. </div>
  37. </div>
  38. </button>
  39. </template>
  40. </div>
  41. <div>
  42. <wd-button block type="text" @click="modelValue = false">取消</wd-button>
  43. </div>
  44. </view>
  45. </wd-action-sheet>
  46. </template>
  47. <style scoped lang="scss"></style>