Browse Source

fix: 组件taro修改

yangxiaolu3 3 years ago
parent
commit
13dc85ea48

+ 1 - 1
src/packages/__VUE/collapseitem/index.taro.vue

@@ -20,7 +20,7 @@
         :class="['nut-collapse-item__title-icon', { 'nut-collapse-item__title-icon--expanded': openExpanded }]"
         :style="{ transform: 'rotate(' + (openExpanded ? rotate : 0) + 'deg)' }"
       >
-        <component :is="renderIcon(icon)"></component>
+        <component v-if="icon" :is="renderIcon(icon)"></component>
       </view>
     </view>
     <view v-if="$slots.extraRender" class="nut-collapse__item-extraWrapper">

+ 1 - 1
src/packages/__VUE/datepicker/index.taro.vue

@@ -133,7 +133,7 @@ export default create({
       return 32 - new Date(year, month - 1, 32).getDate();
     }
     const getBoundary = (type: string, value: Date) => {
-      const boundary = props[`${type}Date`];
+      const boundary = type == 'min' ? props.minDate : props.maxDate;
       const year = boundary.getFullYear();
       let month = 1;
       let date = 1;

+ 3 - 3
src/packages/__VUE/invoice/index.taro.vue

@@ -32,7 +32,7 @@
       </nut-form-item>
     </nut-form>
     <div v-if="submit" class="nut-invoice__submit">
-      <nut-button type="primary" block @click="submit">提交审批</nut-button>
+      <nut-button type="primary" block @click="submitFun">提交审批</nut-button>
     </div>
   </view>
 </template>
@@ -93,7 +93,7 @@ export default create({
       list.value = props.data;
     };
 
-    const submit = () => {
+    const submitFun = () => {
       formRef.value.validate().then(({ valid, errors }: any) => {
         emit('onSubmit', valid, errors);
       });
@@ -110,7 +110,7 @@ export default create({
       classes,
       formRef,
       list,
-      submit
+      submitFun
     };
   }
 });

+ 5 - 2
src/packages/__VUE/picker/common.ts

@@ -1,4 +1,4 @@
-import { ref, onMounted, onBeforeUnmount, reactive, watch, computed, CSSProperties, toRefs, PropType } from 'vue';
+import { ref, onMounted, reactive, watch, computed, CSSProperties, toRefs } from 'vue';
 import { createComponent } from '@/packages/utils/create';
 const { translate } = createComponent('picker');
 import { usePicker } from './usePicker';
@@ -16,7 +16,10 @@ export const componentWeb = {
     const { changeHandler, confirm, defaultValues, columnsList, selectedOptions, columnsType, classes, cancel } =
       usePicker(props, emit);
 
-    const state = reactive({
+    const state = reactive<{
+      ENV: TaroGeneral.ENV_TYPE;
+      ENV_TYPE: Taro.TARO_ENV_TYPE;
+    }>({
       ENV: Taro.getEnv(),
       ENV_TYPE: Taro.ENV_TYPE
     });

+ 3 - 2
src/packages/__VUE/picker/index.taro.vue

@@ -46,7 +46,7 @@
           :visibleOptionNum="visibleOptionNum"
           :optionHeight="optionHeight"
           @change="
-            (option) => {
+            (option:PickerOption) => {
               changeHandler(columnIndex, option);
             }
           "
@@ -61,8 +61,9 @@ import { createComponent } from '@/packages/utils/create';
 import { componentWeb, componentWeapp } from './common';
 import Taro from '@tarojs/taro';
 const { create } = createComponent('picker');
+import { Component } from 'vue';
 
-const component: any = Taro.getEnv() == Taro.ENV_TYPE.WEB ? componentWeb : componentWeapp;
+const component: Component = Taro.getEnv() == Taro.ENV_TYPE.WEB ? componentWeb : componentWeapp;
 
 export default create(component);
 </script>

+ 2 - 1
src/packages/__VUE/picker/index.vue

@@ -20,7 +20,7 @@
           :visibleOptionNum="visibleOptionNum"
           :optionHeight="optionHeight"
           @change="
-            (option) => {
+            (option:PickerOption) => {
               changeHandler(columnIndex, option);
             }
           "
@@ -38,6 +38,7 @@ import { usePicker } from './usePicker';
 import column from './Column.vue';
 import baseProps from './baseProps';
 const { componentName, create, translate } = createComponent('picker');
+import { PickerOption } from './types';
 
 export default create({
   components: {

+ 2 - 2
src/packages/__VUE/popover/index.taro.vue

@@ -85,7 +85,7 @@ export default create({
   components: {},
   props: {
     visible: { type: Boolean, default: false },
-    list: { type: Array, default: [] },
+    list: { type: Array as PropType<import('./type').PopoverList[]>, default: [] },
     theme: { type: String as PropType<import('./type').PopoverTheme>, default: 'light' },
     location: { type: String as PropType<import('./type').PopoverLocation>, default: 'bottom' },
     offset: { type: Array, default: [0, 12] },
@@ -131,7 +131,7 @@ export default create({
       const base = 16;
 
       if (bgColor) {
-        styles[`border${upperCaseFirst(direction)}Color`] = bgColor;
+        styles[`border${upperCaseFirst(direction)}Color` as any] = bgColor;
       }
 
       if (props.arrowOffset != 0) {