Skip to content

Commit

Permalink
chore(audio): improve type def (jd-opensource#2808)
Browse files Browse the repository at this point in the history
  • Loading branch information
eiinu authored Dec 27, 2023
1 parent dffaa6f commit a3680d0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/packages/__VUE/audio/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@
</div>
</template>
<script lang="ts">
import { toRefs, ref, onMounted, reactive, watch, provide } from 'vue';
import { toRefs, ref, onMounted, reactive, watch, provide, type PropType } from 'vue';
import { createComponent } from '@/packages/utils/create';
import { Service } from '@nutui/icons-vue';
import NutRange from '../range/index.vue';
import type { AudioType } from './types';
const { create } = createComponent('audio');
export default create({
Expand Down Expand Up @@ -102,7 +103,7 @@ export default create({
// 展示的形式 controls 控制面板 progress 进度条 icon 图标 none 自定义
type: {
type: String,
type: String as PropType<AudioType>,
default: 'progress'
}
},
Expand Down
1 change: 1 addition & 0 deletions src/packages/__VUE/audio/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type AudioType = 'progress' | 'icon' | 'controls' | 'none';
5 changes: 3 additions & 2 deletions src/packages/__VUE/audiooperate/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
</div>
</template>
<script lang="ts">
import { toRefs, ref, useSlots, reactive, inject } from 'vue';
import { toRefs, ref, useSlots, reactive, inject, type PropType } from 'vue';
import { createComponent } from '@/packages/utils/create';
import NutButton from '../button/index.vue';
import { useLocale } from '@/packages/utils/useLocale';
import type { AudioOperateType } from './types';
const { create } = createComponent('audio-operate');
const cN = 'NutAudioOperate';
Expand All @@ -35,7 +36,7 @@ export default create({
props: {
// 展示的形式 back 倒退 play 开始 or 暂停 forward 快进 mute 静音
type: {
type: String,
type: String as PropType<AudioOperateType>,
default: () => 'play'
}
},
Expand Down
1 change: 1 addition & 0 deletions src/packages/__VUE/audiooperate/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type AudioOperateType = 'play' | 'back' | 'forward' | 'mute';

0 comments on commit a3680d0

Please sign in to comment.