Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | <template>
<v-menu>
<template #activator="{ props }">
<v-btn
v-bind="mergeProps(btnProps, props)"
append-icon="arrow_drop_down"
variant="text"
>
<span>{{ text }}</span>
</v-btn>
</template>
<v-card>
<v-list>
<v-list-item @click="modelValue = SharePermission.Viewer">
<span>{{ viewer }}</span>
</v-list-item>
<v-list-item @click="modelValue = SharePermission.Editor">
<span>{{ editor }}</span>
</v-list-item>
<v-list-item @click="modelValue = SharePermission.NoAccess">
<span>{{ noAccess }}</span>
</v-list-item>
</v-list>
</v-card>
</v-menu>
</template>
<script setup lang="ts">
import { computed, mergeProps } from 'vue';
import { useI18n } from 'vue-i18n';
import { SharePermission } from '@3cr/viewer-types-ts';
interface Props {
btnProps?: Record<string, any>;
}
withDefaults(defineProps<Props>(), {
btnProps: () => ({}),
});
const { t } = useI18n();
const modelValue = defineModel<SharePermission>({
default: SharePermission.NoAccess,
});
const noAccess = computed(() => t('enums.sharePermission.noAccess'));
const viewer = computed(() => t('enums.sharePermission.viewer'));
const editor = computed(() => t('enums.sharePermission.editor'));
const owner = computed(() => t('enums.sharePermission.owner'));
const text = computed(() => {
switch (modelValue.value) {
case SharePermission.NoAccess:
return noAccess.value;
case SharePermission.Viewer:
return viewer.value;
case SharePermission.Editor:
return editor.value;
case SharePermission.Owner:
return owner.value;
}
});
</script>
|