<template>
  <view>
    <u-action-sheet :actions="actionsOptions" :show="show" cancelText="取消" safeAreaInsetBottom round="32rpx" @close="onActionSheetClose" @select="onActionSheetSelect" />
  </view>
</template>

<script>
const actionsOptions = [
  {
    name: '图片',
    type: 'image',
  },
  {
    name: '视频',
    type: 'video',
  },
];

export default {
  name: 'UploadActionSheet',
  props: {
    success: {
      type: Function,
      default: (item) => {},
    },
  },
  data() {
    return {
      show: false,
      actionsOptions,
    };
  },
  methods: {
    async onActionSheetClose() {
      this.show = false;
    },

    async onActionSheetSelect(item) {
      this.success(item);
    },
  },
};
</script>

<style scoped lang="scss">
@import 'UploadActionSheet.scss';
</style>
