Skip to content

vue3+Taro+Nut UI 在使用<nut-input>在小程序端浏览时,出现无法输入的情况,网页端是可以正常输入的 #3299

@Candy0627

Description

@Candy0627

NutUI 包名

@nutui/nutui, @nutui/nutui-taro

NutUI 版本号

"@nutui/nutui": "^4.3.14", "@nutui/nutui-taro": "4.3.13",

平台

weapp

重现链接

{ "name": "digital-minsheng-construction", "author": "", "repository": "", "license": "MulanPSL2", "scripts": { "build:weapp": "set NODE_ENV=production && taro build --type weapp", "build:weapp:watch": "set NODE_ENV=production && taro build --type weapp --watch", "build:h5": "taro build --type h5", "dev": "vite", "dev:weapp": "taro build --type weapp --watch", "dev:h5": "npm run build:h5 -- --watch", "lint:js": "eslint "/*.{ts,tsx,vue}" --fix", "lint:css": "stylelint "/.{css,vue}" --fix", "commit": "git add . && git cz", "uvm": "taro update project", "postinstall": "npx simple-git-hooks" }, "dependencies": { "@nutui/icons-vue-taro": "0.0.9", "@nutui/nutui": "^4.3.14", "@nutui/nutui-taro": "4.3.13", "@tarojs/components": "3.6.35", "@tarojs/helper": "3.6.35", "@tarojs/plugin-framework-vue3": "3.6.35", "@tarojs/plugin-html": "3.6.35", "@tarojs/plugin-http": "3.6.35", "@tarojs/plugin-platform-h5": "3.6.35", "@tarojs/plugin-platform-weapp": "3.6.35", "@tarojs/runtime": "3.6.35", "@tarojs/shared": "3.6.35", "@tarojs/taro": "3.6.35", "axios": "1.7.7", "chrome-aws-lambda": "^1.11.1", "express": "^4.17.1", "pinia": "2.2.4", "pinia-plugin-persistedstate": "4.1.1", "puppeteer-core": "^1.11.0", "vite": "^7.1.3", "vue": "3.4.27", "vue-types": "5.1.3", "webpack-bundle-analyzer": "^4.10.2" }, "devDependencies": { "@babel/core": "^7.24.7", "@babel/runtime": "^7.24.7", "@commitlint/cli": "^19.5.0", "@commitlint/config-conventional": "^19.5.0", "@nutui/auto-import-resolver": "^1.0.0", "@tarojs/cli": "3.6.35", "@tarojs/taro-loader": "3.6.35", "@tarojs/webpack5-runner": "3.6.35", "@types/webpack-env": "^1.18.5", "@typescript-eslint/eslint-plugin": "^7.18.0", "@typescript-eslint/parser": "^7.18.0", "@uni-helper/vite-plugin-uni-components": "^0.2.0", "@vue/babel-plugin-jsx": "^1.2.5", "@vue/compiler-sfc": "3.5.12", "@vue/eslint-config-typescript": "^13.0.0", "babel-preset-taro": "3.6.35", "commitizen": "^4.3.1", "cz-customizable": "^7.2.1", "eslint": "^8.57.1", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-simple-import-sort": "^12.1.1", "eslint-plugin-vue": "^9.29.0", "lint-staged": "^15.2.10", "postcss": "^8.4.47", "postcss-html": "^1.7.0", "prettier": "^3.3.3", "simple-git-hooks": "^2.11.1", "stylelint": "^16.10.0", "stylelint-config-standard": "^36.0.1", "stylelint-prettier": "^5.0.2", "tsconfig-paths-webpack-plugin": "^4.1.0", "typescript": "^5.5.6", "unplugin-vue-components": "^0.27.4", "vue-loader": "^17.4.2", "webpack": "5.92.1" }, "browserslist": [ "Chrome >= 51", "ios >= 10" ], "config": { "commitizen": { "path": "cz-customizable" } }, "lint-staged": { ".{ts,tsx,vue}": [ "eslint --fix", "prettier --write" ], ".{css,vue}": [ "stylelint --fix --allow-empty-input", "prettier --write" ], "src/**/.{js,ts,vue}": ["eslint --fix", "git add"] }, "simple-git-hooks": { "pre-commit": "npx lint-staged", "commit-msg": "npx commitlint --edit $1" } }

重现步骤

登 录 <script setup lang="ts"> import type { ILogin } from '@/api/types/useUser' import { login } from '@/api/user' import { useUserStore } from '@/store/userStore' import Taro from '@tarojs/taro' import { reactive, ref } from 'vue' const formRef = ref() const formData = reactive({ phone: '', password: '' }) const toastVisible = ref(false) const toastMsg = ref('') const showToast = (msg: string) => { toastMsg.value = msg toastVisible.value = true } const userStore = useUserStore() const setStorage = (key: string, value: any) => { if (process.env.TARO_ENV === 'h5') { localStorage.setItem(key, typeof value === 'string' ? value : JSON.stringify(value)) } else { Taro.setStorageSync(key, value) } } const submit = async () => { formRef.value?.validate().then(async ({ valid, errors }) => { if (valid) { await submitLogin(formData) } else { showToast('请完善表单信息') } }) } const submitLogin = async (data: ILogin) => { try { const res = await login(data) const result = res && typeof res === 'object' ? res : {} const success = result.success ?? result.code === 200 const message = result.message ?? result.msg ?? '' const userData = result.data ?? result.user ?? {} if (success) { userStore.setToken(userData.token) userStore.setUserInfo(userData.user) setStorage('token', userData.token) setStorage('userInfo', userData.user) } else { showToast(message) } } catch (error) { showToast('登录失败') console.error('登录失败:', error) } } const reset = () => { formRef.value?.reset && formRef.value.reset() } const asyncValidator = (val: string) => { const telReg = /^400(-?)[0-9]{7}$|^1\d{10}$|^0[0-9]{2,3}-[0-9]{7,8}$/ return new Promise((resolve, reject) => { setTimeout(() => { if (!val) { reject('请输入联系电话') } else if (!telReg.test(val)) { reject('联系电话格式不正确') } else { resolve('') } }, 1000) }) } </script>

期望的结果是什么?

nut-input在小程序端可以正常输入

实际的结果是什么?

nut-input在小程序端无法正常输入

环境信息

No response

其他补充信息

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions