b2nil / taro-ui-vue3

采用 Vue 3.0 重写的 Taro UI 组件库
https://b2nil.github.io/taro-ui-vue3/
MIT License
160 stars 51 forks source link

at-input 组件 当type为digit,值默认为0时,输入框后面会出现0 #81

Closed domsgit closed 3 years ago

domsgit commented 3 years ago

问题描述

at-input 组件 当type为digit,值默认为0时,输入框后面会出现0

版本信息

1.0.0-alpha.17

涉及的平台

weapp

错误信息

// error message here
//样式错误

代码

// code here
<at-input
  style="text-align:right"
  clear
  name="value"
  title="标题"
  type="digit"
  placeholder="请输入"
  :value="0"
/>
domsgit commented 3 years ago

补充: 当value为Number的0时会如此。但是当value值为String的'0'时正常。

b2nil commented 3 years ago

clear 这里导致的问题。true && 0 && (h(view, ...)) 最终渲染出来的是 0, 而不是图标。

(props.clear && props.value) && (  // <-  最终渲染出来的是 `0`, 而不是图标,所以多了个 0。
     h(View, {
         class: 'at-input__icon',
          onTouchStart: handleClearValue
    }, {
          default: () => [
                h(Text, {
                        class: 'at-icon at-icon-close-circle at-input__icon-close'
                 })
           ]
    })
) || null
b2nil commented 3 years ago

fixed in e4d840fd3fe69e6b8ee3879ba0bf39d80ce98871