Skip to content

Commit

Permalink
fix(dts): 修复部分组件事件类型丢失问题 (#2469)
Browse files Browse the repository at this point in the history
  • Loading branch information
eiinu authored Aug 4, 2023
1 parent 8314101 commit 80a3ad4
Show file tree
Hide file tree
Showing 13 changed files with 594 additions and 350 deletions.
74 changes: 0 additions & 74 deletions src/packages/__VUE/fixednav/common.ts

This file was deleted.

82 changes: 74 additions & 8 deletions src/packages/__VUE/fixednav/index.taro.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,80 @@
<template src="./template.html"></template>
<script lang="ts">
import { createComponent } from '@/packages/utils/create';
import { component } from './common';
import OverLay from '../overlay/index.taro.vue';
const { create } = createComponent('fixed-nav');
import { PropType, computed, ref } from 'vue';
import { Left } from '@nutui/icons-vue-taro';
export default create(
component({
import OverLay from '../overlay/index.taro.vue';
import { createComponent } from '@/packages/utils/create';
const { translate, create, componentName } = createComponent('fixed-nav');
export default create({
components: {
[OverLay.name]: OverLay,
Left
})
);
},
props: {
visible: {
type: Boolean,
default: false
},
overlay: {
type: Boolean,
default: true
},
navList: {
default: () => [],
type: Array as PropType<any[]>
},
activeColor: {
default: '',
type: String
},
activeText: {
default: '',
type: String
},
unActiveText: {
default: '',
type: String
},
position: {
default: () => {
return {
top: 'auto',
bottom: 'auto'
};
},
type: Object
},
type: {
default: 'right',
type: String
}
},
emits: ['update:visible', 'selected'],
setup(props: any, { emit }: any) {
const classes = computed(() => {
const prefixCls = componentName;
return {
[prefixCls]: true,
active: props.visible,
[props.type]: true
};
});
const current = ref(-1);
const updateValue = (value: boolean = !props.visible) => {
emit('update:visible', value);
};
const selected = (item: any, event: Event) => {
emit('selected', {
item,
event
});
current.value = item.id;
};
return { classes, updateValue, selected, translate, current };
}
});
</script>
82 changes: 74 additions & 8 deletions src/packages/__VUE/fixednav/index.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,80 @@
<template src="./template.html"></template>
<script lang="ts">
import { createComponent } from '@/packages/utils/create';
import { component } from './common';
import OverLay from '../overlay/index.vue';
const { create } = createComponent('fixed-nav');
import { PropType, computed, ref } from 'vue';
import { Left } from '@nutui/icons-vue';
export default create(
component({
import OverLay from '../overlay/index.vue';
import { createComponent } from '@/packages/utils/create';
const { translate, create, componentName } = createComponent('fixed-nav');
export default create({
components: {
[OverLay.name]: OverLay,
Left
})
);
},
props: {
visible: {
type: Boolean,
default: false
},
overlay: {
type: Boolean,
default: true
},
navList: {
default: () => [],
type: Array as PropType<any[]>
},
activeColor: {
default: '',
type: String
},
activeText: {
default: '',
type: String
},
unActiveText: {
default: '',
type: String
},
position: {
default: () => {
return {
top: 'auto',
bottom: 'auto'
};
},
type: Object
},
type: {
default: 'right',
type: String
}
},
emits: ['update:visible', 'selected'],
setup(props: any, { emit }: any) {
const classes = computed(() => {
const prefixCls = componentName;
return {
[prefixCls]: true,
active: props.visible,
[props.type]: true
};
});
const current = ref(-1);
const updateValue = (value: boolean = !props.visible) => {
emit('update:visible', value);
};
const selected = (item: any, event: Event) => {
emit('selected', {
item,
event
});
current.value = item.id;
};
return { classes, updateValue, selected, translate, current };
}
});
</script>
Empty file.
7 changes: 3 additions & 4 deletions src/packages/__VUE/formitem/index.taro.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<script lang="ts">
import { pxCheck } from '@/packages/utils/pxCheck';
import { computed, inject, provide, PropType, CSSProperties } from 'vue';
import type { FormItemRule } from './types';
import { createComponent } from '@/packages/utils/create';
import Cell from '../cell/index.taro.vue';
const { create } = createComponent('form-item');
Expand All @@ -40,10 +41,8 @@ export default create({
default: ''
},
rules: {
type: Array as PropType<import('./types').FormItemRule[]>,
default: () => {
return [];
}
type: Array as PropType<FormItemRule[]>,
default: () => []
},
required: {
type: Boolean,
Expand Down
7 changes: 3 additions & 4 deletions src/packages/__VUE/formitem/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<script lang="ts">
import { pxCheck } from '@/packages/utils/pxCheck';
import { computed, inject, provide, PropType, CSSProperties } from 'vue';
import type { FormItemRule } from './types';
import { createComponent } from '@/packages/utils/create';
import Cell from '../cell/index.vue';
const { create } = createComponent('form-item');
Expand All @@ -40,10 +41,8 @@ export default create({
default: ''
},
rules: {
type: Array as PropType<import('./types').FormItemRule[]>,
default: () => {
return [];
}
type: Array as PropType<FormItemRule[]>,
default: () => []
},
required: {
type: Boolean,
Expand Down
Loading

0 comments on commit 80a3ad4

Please sign in to comment.