Browse Source

fix(input): 组件透传属性移动至原生标签上

eiinu 3 years ago
parent
commit
7fe67faf63
1 changed files with 5 additions and 3 deletions
  1. 5 3
      src/packages/__VUE/input/index.taro.vue

+ 5 - 3
src/packages/__VUE/input/index.taro.vue

@@ -1,7 +1,7 @@
 <template>
 <template>
   <view :class="classes">
   <view :class="classes">
     <view v-if="leftIcon && leftIcon.length > 0" class="nut-input-left-icon" @click="onClickLeftIcon">
     <view v-if="leftIcon && leftIcon.length > 0" class="nut-input-left-icon" @click="onClickLeftIcon">
-      <nut-icon :name="leftIcon" v-bind="$attrs" :size="leftIconSize"></nut-icon>
+      <nut-icon :name="leftIcon" :size="leftIconSize"></nut-icon>
     </view>
     </view>
     <view
     <view
       v-if="label"
       v-if="label"
@@ -31,6 +31,7 @@
             <textarea
             <textarea
               v-if="type == 'textarea'"
               v-if="type == 'textarea'"
               class="input-text"
               class="input-text"
+              v-bind="$attrs"
               ref="inputRef"
               ref="inputRef"
               :style="stylesTextarea"
               :style="stylesTextarea"
               :maxlength="maxLength"
               :maxlength="maxLength"
@@ -50,6 +51,7 @@
             <input
             <input
               v-else
               v-else
               class="input-text"
               class="input-text"
+              v-bind="$attrs"
               ref="inputRef"
               ref="inputRef"
               :style="styles"
               :style="styles"
               :type="inputType(type)"
               :type="inputType(type)"
@@ -78,14 +80,13 @@
               v-if="clearable && !readonly"
               v-if="clearable && !readonly"
               v-show="active && modelValue.length > 0"
               v-show="active && modelValue.length > 0"
               :name="clearIcon"
               :name="clearIcon"
-              v-bind="$attrs"
               :size="clearSize"
               :size="clearSize"
               @click="clear"
               @click="clear"
             >
             >
             </nut-icon>
             </nut-icon>
           </view>
           </view>
           <view v-if="rightIcon && rightIcon.length > 0" class="nut-input-right-icon" @click="onClickRightIcon">
           <view v-if="rightIcon && rightIcon.length > 0" class="nut-input-right-icon" @click="onClickRightIcon">
-            <nut-icon :name="rightIcon" v-bind="$attrs" :size="rightIconSize"></nut-icon>
+            <nut-icon :name="rightIcon" :size="rightIconSize"></nut-icon>
           </view>
           </view>
           <slot v-if="$slots.button" name="button" class="nut-input-button"></slot>
           <slot v-if="$slots.button" name="button" class="nut-input-button"></slot>
           <slot v-if="$slots.rightExtra" name="rightExtra"></slot>
           <slot v-if="$slots.rightExtra" name="rightExtra"></slot>
@@ -125,6 +126,7 @@ export type InputRule = {
 export type ConfirmTextType = 'send' | 'search' | 'next' | 'go' | 'done';
 export type ConfirmTextType = 'send' | 'search' | 'next' | 'go' | 'done';
 
 
 export default create({
 export default create({
+  inheritAttrs: false,
   props: {
   props: {
     ref: {
     ref: {
       type: String,
       type: String,