Skip to content

Commit

Permalink
chore(drag): improve type def (#2753)
Browse files Browse the repository at this point in the history
  • Loading branch information
eiinu authored Dec 16, 2023
1 parent cc59b47 commit ad3a46d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/packages/__VUE/drag/index.taro.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,21 @@
</template>

<script lang="ts">
import { onMounted, onDeactivated, onActivated, reactive, ref } from 'vue';
import { onMounted, onDeactivated, onActivated, reactive, ref, PropType } from 'vue';
import { createComponent } from '@/packages/utils/create';
import requestAniFrame from '@/packages/utils/raf';
import { useTaroRect } from '@/packages/utils/useTaroRect';
const { create } = createComponent('drag');
import Taro, { eventCenter, getCurrentInstance } from '@tarojs/taro';
import { DragDirection } from './types';
const { create } = createComponent('drag');
export default create({
props: {
attract: {
type: Boolean,
default: false
},
direction: {
type: String,
type: String as PropType<DragDirection>,
default: 'all'
},
boundary: {
Expand Down
5 changes: 3 additions & 2 deletions src/packages/__VUE/drag/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
</template>

<script lang="ts">
import { onMounted, onDeactivated, onActivated, reactive, ref } from 'vue';
import { onMounted, onDeactivated, onActivated, reactive, ref, PropType } from 'vue';
import { createComponent } from '@/packages/utils/create';
import requestAniFrame from '@/packages/utils/raf';
import { DragDirection } from './types';
const { create } = createComponent('drag');
export default create({
props: {
Expand All @@ -22,7 +23,7 @@ export default create({
default: false
},
direction: {
type: String,
type: String as PropType<DragDirection>,
default: 'all'
},
boundary: {
Expand Down
1 change: 1 addition & 0 deletions src/packages/__VUE/drag/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type DragDirection = 'all' | 'x' | 'y';

0 comments on commit ad3a46d

Please sign in to comment.