NervJS / taro-ui

一款基于 Taro 框架开发的多端 UI 组件库
https://taro-ui.taro.zone
MIT License
4.55k stars 756 forks source link

AtInput没有渲染出Input元素 #1809

Open Tarwooz opened 3 months ago

Tarwooz commented 3 months ago

问题描述 在AtForm或者Taro form组件里面的AtInput没有渲染出Input输入框. html里面没有Input元素

import { View } from '@tarojs/components'
import { useLoad } from '@tarojs/taro'
import './index.less'
import { AtForm, AtInput } from 'taro-ui'

export default function Test() {
    useLoad(() => {
        console.log('Page loaded.')
    })

    return (
        <View className="test">
            <View>11111</View>
            <AtForm>
                <AtInput name={'ddd'} title={'顶顶顶顶'} placeholder={'sss'} />
            </AtForm>
        </View>
    )
}

期望行为

报错信息 image

系统信息

👽 Taro v3.6.32

🎯 验证环境信息!
[✓]  安装的 Node 版本为 v18.20.4

🎯 验证项目配置 (/config/index.js) !
[✓]  成功获取远程配置验证文件:https://raw.githubusercontent.com/NervJS/taro-doctor/main/assets/config_schema.json
[✓]  项目配置正确!

🎯 验证项目依赖安装正确性!
[!]  本地已经安装了 Taro CLI 版本为 3.6.32,建议使用 npm script 来执行项目的预览和打包
本地安装的 Taro 相关依赖版本信息如下:
- @tarojs/components: 3.6.32
- @tarojs/helper: 3.6.32
- @tarojs/plugin-framework-react: 3.6.32
- @tarojs/plugin-platform-alipay: 3.6.32
- @tarojs/plugin-platform-h5: 3.6.32
- @tarojs/plugin-platform-harmony-hybrid: 3.6.32
- @tarojs/plugin-platform-jd: 3.6.32
- @tarojs/plugin-platform-qq: 3.6.32
- @tarojs/plugin-platform-swan: 3.6.32
- @tarojs/plugin-platform-tt: 3.6.32
- @tarojs/plugin-platform-weapp: 3.6.32
- @tarojs/react: 3.6.32
- @tarojs/runtime: 3.6.32
- @tarojs/shared: 3.6.32
- @tarojs/taro: 3.6.32
- @tarojs/cli: 3.6.32
- @tarojs/taro-loader: 3.6.32
- @tarojs/test-utils-react: 0.1.1
- @tarojs/webpack5-runner: 3.6.32
👽 Taro v3.6.32

  Taro CLI 3.6.32 environment info:
    System:
      OS: Linux 6.8 Ubuntu 24.04 LTS 24.04 LTS (Noble Numbat)
      Shell: 5.9 - /usr/bin/zsh
    Binaries:
      Node: 18.20.4 - ~/.nvm/nvm-0.39.7/versions/node/v18.20.4/bin/node
      Yarn: 1.22.22 - ~/.nvm/nvm-0.39.7/versions/node/v18.20.4/bin/yarn
      npm: 10.7.0 - ~/.nvm/nvm-0.39.7/versions/node/v18.20.4/bin/npm
    npmPackages:
      @tarojs/cli: 3.6.32 => 3.6.32 
      @tarojs/components: 3.6.32 => 3.6.32 
      @tarojs/helper: 3.6.32 => 3.6.32 
      @tarojs/plugin-framework-react: 3.6.32 => 3.6.32 
      @tarojs/plugin-platform-alipay: 3.6.32 => 3.6.32 
      @tarojs/plugin-platform-h5: 3.6.32 => 3.6.32 
      @tarojs/plugin-platform-jd: 3.6.32 => 3.6.32 
      @tarojs/plugin-platform-qq: 3.6.32 => 3.6.32 
      @tarojs/plugin-platform-swan: 3.6.32 => 3.6.32 
      @tarojs/plugin-platform-tt: 3.6.32 => 3.6.32 
      @tarojs/plugin-platform-weapp: 3.6.32 => 3.6.32 
      @tarojs/react: 3.6.32 => 3.6.32 
      @tarojs/runtime: 3.6.32 => 3.6.32 
      @tarojs/shared: 3.6.32 => 3.6.32 
      @tarojs/taro: 3.6.32 => 3.6.32 
      @tarojs/taro-loader: 3.6.32 => 3.6.32 
      @tarojs/webpack5-runner: 3.6.32 => 3.6.32 
      babel-preset-taro: 3.6.32 => 3.6.32 
      eslint-config-taro: 3.6.32 => 3.6.32 
      react: ^18.0.0 => 18.3.1 
      taro-ui: 3. => 3.3.0 
"dependencies": {
    "@babel/runtime": "^7.21.5",
    "@reduxjs/toolkit": "^2.2.6",
    "@tarojs/components": "3.6.32",
    "@tarojs/helper": "3.6.32",
    "@tarojs/plugin-framework-react": "3.6.32",
    "@tarojs/plugin-platform-alipay": "3.6.32",
    "@tarojs/plugin-platform-h5": "3.6.32",
    "@tarojs/plugin-platform-harmony-hybrid": "3.6.32",
    "@tarojs/plugin-platform-jd": "3.6.32",
    "@tarojs/plugin-platform-qq": "3.6.32",
    "@tarojs/plugin-platform-swan": "3.6.32",
    "@tarojs/plugin-platform-tt": "3.6.32",
    "@tarojs/plugin-platform-weapp": "3.6.32",
    "@tarojs/react": "3.6.32",
    "@tarojs/runtime": "3.6.32",
    "@tarojs/shared": "3.6.32",
    "@tarojs/taro": "3.6.32",
    "fs": "^0.0.1-security",
    "os": "^0.1.2",
    "process": "^0.11.10",
    "react": "^18.0.0",
    "react-dom": "^18.0.0",
    "taro-ui": "^3.3.0",
    "zustand": "^4.5.4"
  },
  "devDependencies": {
    "@babel/core": "^7.8.0",
    "@pmmmwh/react-refresh-webpack-plugin": "^0.5.5",
    "@tarojs/cli": "3.6.32",
    "@tarojs/taro-loader": "3.6.32",
    "@tarojs/test-utils-react": "^0.1.1",
    "@tarojs/webpack5-runner": "3.6.32",
    "@types/jest": "^29.3.1",
    "@types/node": "^18.15.11",
    "@types/react": "^18.0.0",
    "@types/webpack-env": "^1.13.6",
    "@typescript-eslint/eslint-plugin": "^6.2.0",
    "@typescript-eslint/parser": "^6.2.0",
    "babel-preset-taro": "3.6.32",
    "crypto-js": "^4.2.0",
    "eslint": "^8.12.0",
    "eslint-config-taro": "3.6.32",
    "eslint-plugin-import": "^2.12.0",
    "eslint-plugin-react": "^7.8.2",
    "eslint-plugin-react-hooks": "^4.2.0",
    "idb-keyval": "^6.2.1",
    "jest": "^29.3.1",
    "jest-environment-jsdom": "^29.5.0",
    "postcss": "^8.4.18",
    "react-refresh": "^0.11.0",
    "stylelint": "^14.4.0",
    "ts-node": "^10.9.1",
    "tsconfig-paths-webpack-plugin": "^4.1.0",
    "typescript": "^5.1.0",
    "webpack": "5.78.0"
  }

image

taro-ui-bot[bot] commented 3 months ago

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

xiejingpeng commented 1 month ago

+1

xiejingpeng commented 1 month ago

import { Input } from '@tarojs/components'

需要手动引用下 Input 可以暂时解决问题

xiejingpeng commented 1 month ago

而且我发现在这个版本,大部分 Form 组件都有这个问题。

Tatekii commented 1 month ago

+1

Tatekii commented 1 month ago

import { Input } from '@tarojs/components'

需要手动引用下 Input 可以暂时解决问题

试了一会,引用了Input再在return里丢一个不显示的input能稳定渲染出来

<Input style={{display:'none'}}/>