Skip to content

Commit

Permalink
chore: remove some any type (#2927)
Browse files Browse the repository at this point in the history
  • Loading branch information
eiinu authored Feb 19, 2024
1 parent 1aa7d68 commit cfab898
Show file tree
Hide file tree
Showing 20 changed files with 45 additions and 45 deletions.
2 changes: 1 addition & 1 deletion src/packages/__VUE/address/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export default create({
},
emits: ['update:visible', 'update:modelValue', 'type', 'change', 'selected', 'close', 'closeMask', 'switchModule'],
setup(props: any, { emit }) {
setup(props, { emit }) {
const translate = useLocale(cN);
const regionLine = ref<null | HTMLElement>(null);
const tabRegion: Ref<any> = ref(null);
Expand Down
8 changes: 4 additions & 4 deletions src/packages/__VUE/countdown/index.taro.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default create({
'onPaused'
],
setup(props: any, { emit, slots }) {
setup(props, { emit, slots }) {
const translate = useLocale(cN);
const state = reactive({
restTime: 0, // 倒计时剩余时间时间
Expand All @@ -95,7 +95,7 @@ export default create({
// 倒计时 interval
const initTime = () => {
state.handleEndTime = props.endTime;
state.handleEndTime = Number(props.endTime);
state.diffTime = Date.now() - getTimeStamp(props.startTime); // 时间差
if (!state.counting) state.counting = true;
tick();
Expand Down Expand Up @@ -216,15 +216,15 @@ export default create({
const reset = () => {
if (!props.autoStart) {
pause();
state.restTime = props.time;
state.restTime = Number(props.time);
}
};
onBeforeMount(() => {
if (props.autoStart) {
initTime();
} else {
state.restTime = props.time;
state.restTime = Number(props.time);
}
});
Expand Down
8 changes: 4 additions & 4 deletions src/packages/__VUE/countdown/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default create({
'onPaused'
],
setup(props: any, { emit, slots }) {
setup(props, { emit, slots }) {
const translate = useLocale(cN);
const state = reactive({
restTime: 0, // 倒计时剩余时间时间
Expand All @@ -95,7 +95,7 @@ export default create({
// 倒计时 interval
const initTime = () => {
state.handleEndTime = props.endTime;
state.handleEndTime = Number(props.endTime);
state.diffTime = Date.now() - getTimeStamp(props.startTime); // 时间差
if (!state.counting) state.counting = true;
tick();
Expand Down Expand Up @@ -216,15 +216,15 @@ export default create({
const reset = () => {
if (!props.autoStart) {
pause();
state.restTime = props.time;
state.restTime = Number(props.time);
}
};
onBeforeMount(() => {
if (props.autoStart) {
initTime();
} else {
state.restTime = props.time;
state.restTime = Number(props.time);
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/packages/__VUE/fixednav/index.taro.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default create({
},
emits: ['update:visible', 'selected'],
setup(props: any, { emit }: any) {
setup(props, { emit }) {
const translate = useLocale(cN);
const classes = computed(() => {
const prefixCls = 'nut-fixed-nav';
Expand Down
2 changes: 1 addition & 1 deletion src/packages/__VUE/fixednav/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default create({
},
emits: ['update:visible', 'selected'],
setup(props: any, { emit }: any) {
setup(props, { emit }) {
const translate = useLocale(cN);
const classes = computed(() => {
const prefixCls = 'nut-fixed-nav';
Expand Down
2 changes: 1 addition & 1 deletion src/packages/__VUE/skeleton/index.taro.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default create({
}
},
setup(props: any) {
setup(props) {
const { avatarShape, round, avatarSize } = toRefs(props);
const avatarClass = computed(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/packages/__VUE/skeleton/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default create({
}
},
setup(props: any) {
setup(props) {
const { avatarShape, round, avatarSize } = toRefs(props);
const avatarClass = computed(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/packages/__VUE/sku/components/SkuOperate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default create({
},
emits: ['click', 'changeSku', 'changeBuyCount', 'clickBtnOperate'],
setup(props: any, { emit, slots }) {
setup(props, { emit, slots }) {
const getBtnDesc = (type: string) => {
let mapD: { [props: string]: string } = {
confirm: props.confirmText,
Expand Down
2 changes: 1 addition & 1 deletion src/packages/__VUE/sku/components/SkuSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default create({
},
emits: ['selectSku'],
setup(props: any, { emit }) {
setup(props, { emit }) {
const skuInfo = ref<SkuInfo[]>([]);
watch(
Expand Down
12 changes: 6 additions & 6 deletions src/packages/__VUE/sku/components/SkuStepper.taro.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
</template>
<script lang="ts">
import { ref, onMounted } from 'vue';
import { TypeOfFun } from '@/packages/utils/util';
import { createComponent } from '@/packages/utils/create';
import NutInputNumber from '../../inputnumber/index.taro.vue';
const { create } = createComponent('sku-stepper');
Expand Down Expand Up @@ -53,7 +52,7 @@ export default create({
NutInputNumber
},
setup(props: any, { emit }) {
setup(props, { emit }) {
const goodsCount = ref(props.stepperMin);
onMounted(() => {
Expand All @@ -63,10 +62,11 @@ export default create({
const getExtraText = () => {
const { stepperExtraText } = props;
if (stepperExtraText && TypeOfFun(stepperExtraText) == 'function') {
return stepperExtraText();
} else {
return '';
if (stepperExtraText) {
if (stepperExtraText === true) {
return '';
}
return stepperExtraText?.();
}
};
Expand Down
12 changes: 6 additions & 6 deletions src/packages/__VUE/sku/components/SkuStepper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
</template>
<script lang="ts">
import { ref, onMounted } from 'vue';
import { TypeOfFun } from '@/packages/utils/util';
import { createComponent } from '@/packages/utils/create';
import NutInputNumber from '../../inputnumber/index.vue';
const { create } = createComponent('sku-stepper');
Expand Down Expand Up @@ -53,7 +52,7 @@ export default create({
NutInputNumber
},
setup(props: any, { emit }) {
setup(props, { emit }) {
const goodsCount = ref(props.stepperMin);
onMounted(() => {
Expand All @@ -63,10 +62,11 @@ export default create({
const getExtraText = () => {
const { stepperExtraText } = props;
if (stepperExtraText && TypeOfFun(stepperExtraText) == 'function') {
return stepperExtraText();
} else {
return '';
if (stepperExtraText) {
if (stepperExtraText === true) {
return '';
}
return stepperExtraText?.();
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/packages/__VUE/sku/index.taro.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export default create({
NutScrollView
},
setup(props: any, { emit, slots }) {
setup(props, { emit, slots }) {
const translate = useLocale(cN);
const showPopup = ref(props.visible);
Expand Down
2 changes: 1 addition & 1 deletion src/packages/__VUE/sku/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export default create({
NutPopup
},
setup(props: any, { emit, slots }) {
setup(props, { emit, slots }) {
const translate = useLocale(cN);
const showPopup = ref(props.visible);
Expand Down
4 changes: 2 additions & 2 deletions src/packages/__VUE/table/index.taro.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default create({
}
},
emits: ['sorter'],
setup(props: any, { emit }) {
setup(props, { emit }) {
const translate = useLocale(cN);
const state = reactive({
Expand Down Expand Up @@ -131,7 +131,7 @@ export default create({
const sortDataItem = () => {
return props.columns.map((columns: TableColumns) => {
return [columns.key, columns.render];
});
}) as [string, any][];
};
watch(
Expand Down
8 changes: 4 additions & 4 deletions src/packages/__VUE/table/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default create({
}
},
emits: ['sorter'],
setup(props: any, { emit }) {
setup(props, { emit }) {
const translate = useLocale(cN);
const state = reactive({
Expand Down Expand Up @@ -123,15 +123,15 @@ export default create({
typeof item.sorter === 'function'
? state.curData.sort(item.sorter)
: item.sorter === 'default'
? state.curData.sort()
: state.curData;
? state.curData.sort()
: state.curData;
}
};
const sortDataItem = () => {
return props.columns.map((columns: TableColumns) => {
return [columns.key, columns.render];
});
}) as [string, any][];
};
watch(
Expand Down
2 changes: 1 addition & 1 deletion src/packages/__VUE/tabs/index.taro.vue
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export default create({
},
emits: ['update:modelValue', 'click', 'change'],
setup(props: any, { emit, slots }: any) {
setup(props, { emit, slots }: any) {
const refRandomId = Math.random().toString(36).slice(-8);
const container = ref(null);
provide('tabsOpiton', {
Expand Down
2 changes: 1 addition & 1 deletion src/packages/__VUE/tabs/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export default create({
},
emits: ['update:modelValue', 'click', 'change'],
setup(props: any, { emit, slots }: any) {
setup(props, { emit, slots }: any) {
const container = ref<any>(null);
let stickyFixed: boolean;
provide('tabsOpiton', {
Expand Down
4 changes: 2 additions & 2 deletions src/packages/__VUE/timepannel/index.taro.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default create({
}
},
emits: ['change'],
setup: (props: any, context: any) => {
setup: (props, { emit }) => {
const currentKey = inject('currentKey');
const state = reactive({
Expand All @@ -35,7 +35,7 @@ export default create({
});
const handlePannel = (pannelKey: number | string) => {
context.emit('change', pannelKey);
emit('change', pannelKey);
};
return {
Expand Down
4 changes: 2 additions & 2 deletions src/packages/__VUE/timepannel/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default create({
}
},
emits: ['change'],
setup: (props: any, context: any) => {
setup: (props, { emit }) => {
const currentKey = inject('currentKey');
const state = reactive({
Expand All @@ -35,7 +35,7 @@ export default create({
});
const handlePannel = (pannelKey: number | string) => {
context.emit('change', pannelKey);
emit('change', pannelKey);
};
return {
Expand Down
8 changes: 4 additions & 4 deletions src/packages/__VUE/toast/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ export default create({
}
},
emits: ['close'],
setup(props: any, { emit }) {
let timer: NodeJS.Timeout | null | undefined;
setup(props, { emit }) {
let timer: null | number | undefined;
const state = reactive({
mounted: false
});
Expand All @@ -113,7 +113,7 @@ export default create({
const show = () => {
clearTimer();
if (props.duration) {
timer = setTimeout(() => {
timer = window.setTimeout(() => {
hide();
}, props.duration);
}
Expand Down Expand Up @@ -161,7 +161,7 @@ export default create({
});
const onAfterLeave = () => {
clearTimer();
props.unmount(props.id);
props.unmount?.(props.id);
props.onClose && props.onClose();
};
Expand Down

0 comments on commit cfab898

Please sign in to comment.