NutUI 包名
@nutui/nutui-taro
NutUI 版本号
4.3.15-beta.1
平台
h5
重现链接
https://nutui.jd.com/playground/#eyJBcHAudnVlIjoiPHNjcmlwdCBzZXR1cCBsYW5nPVwidHNcIj5cbmltcG9ydCB7IHNob3dUb2FzdCB9IGZyb20gJ0BudXR1aS9udXR1aSdcbmltcG9ydCB7IERvbmdkb25nIH0gZnJvbSAnQG51dHVpL2ljb25zLXZ1ZSdcbmNvbnN0IHNob3cgPSAoKSA9PiB7XG4gIHNob3dUb2FzdC50ZXh0KCdIZWxsbywgTnV0VUkhJylcbn07XG48L3NjcmlwdD5cbjx0ZW1wbGF0ZT5cbiAgPG51dC1jZWxsIHRpdGxlPVwiQ2xpY2sgdG8gc2hvdyBUb2FzdFwiIGlzLWxpbmsgQGNsaWNrPVwic2hvd1wiPlxuICAgIDx0ZW1wbGF0ZSAjbGluaz5cbiAgICAgIDxEb25nZG9uZyAvPlxuICAgICAgPHZpZXc+6L+Z6YeM5aSN546w5LiN5Ye65p2lPC92aWV3PlxuICAgICAgPG51dC11cGxvYWRlciB1cmw9XCJodHRwczovL3h4eHhcIj48L251dC11cGxvYWRlcj5cbiAgICA8L3RlbXBsYXRlPlxuICA8L251dC1jZWxsPlxuPC90ZW1wbGF0ZT4ifQ==
重现步骤
我看了当前的github和项目node_modules包的uploader的源码,上传这里的环境判断是这样的,导致我多端开发的时候,在浏览器H5进行文件上传会报错
if (Taro.getEnv() == "WEB") {
let el = document.getElementById("taroChooseImage");
if (el) {
el == null ? void 0 : el.setAttribute("accept", props.accept);
} else {
const obj = document.createElement("input");
obj.setAttribute("type", "file");
obj.setAttribute("id", "taroChooseImage");
obj.setAttribute("accept", props.accept);
obj.setAttribute("style", "position: fixed; top: -4000px; left: -3000px; z-index: -300;");
document.body.appendChild(obj);
}
}
期望的结果是什么?
是否多端不适合开发H5?
实际的结果是什么?
多端不适合开发H5
环境信息
Taro CLI 4.1.11 environment info:
System:
OS: Windows 11 10.0.26100
Binaries:
Node: 22.22.2
Yarn: 1.22.22
npm: 10.9.7
npmPackages:
@tarojs/cli: 4.1.11 => 4.1.11
@tarojs/components: 4.1.11 => 4.1.11
@tarojs/helper: 4.1.11 => 4.1.11
@tarojs/plugin-framework-vue3: 4.1.11 => 4.1.11
@tarojs/plugin-html: 4.1.11 => 4.1.11
@tarojs/plugin-platform-alipay: 4.1.11 => 4.1.11
@tarojs/plugin-platform-h5: 4.1.11 => 4.1.11
@tarojs/plugin-platform-jd: 4.1.11 => 4.1.11
@tarojs/plugin-platform-qq: 4.1.11 => 4.1.11
@tarojs/plugin-platform-swan: 4.1.11 => 4.1.11
@tarojs/plugin-platform-tt: 4.1.11 => 4.1.11
@tarojs/plugin-platform-weapp: 4.1.11 => 4.1.11
@tarojs/runtime: 4.1.11 => 4.1.11
@tarojs/shared: 4.1.11 => 4.1.11
@tarojs/taro: 4.1.11 => 4.1.11
@tarojs/vite-runner: 4.1.11 => 4.1.11
babel-preset-taro: 4.1.11 => 4.1.11
eslint-config-taro: 4.1.11 => 4.1.11
其他补充信息
No response
NutUI 包名
@nutui/nutui-taro
NutUI 版本号
4.3.15-beta.1
平台
h5
重现链接
https://nutui.jd.com/playground/#eyJBcHAudnVlIjoiPHNjcmlwdCBzZXR1cCBsYW5nPVwidHNcIj5cbmltcG9ydCB7IHNob3dUb2FzdCB9IGZyb20gJ0BudXR1aS9udXR1aSdcbmltcG9ydCB7IERvbmdkb25nIH0gZnJvbSAnQG51dHVpL2ljb25zLXZ1ZSdcbmNvbnN0IHNob3cgPSAoKSA9PiB7XG4gIHNob3dUb2FzdC50ZXh0KCdIZWxsbywgTnV0VUkhJylcbn07XG48L3NjcmlwdD5cbjx0ZW1wbGF0ZT5cbiAgPG51dC1jZWxsIHRpdGxlPVwiQ2xpY2sgdG8gc2hvdyBUb2FzdFwiIGlzLWxpbmsgQGNsaWNrPVwic2hvd1wiPlxuICAgIDx0ZW1wbGF0ZSAjbGluaz5cbiAgICAgIDxEb25nZG9uZyAvPlxuICAgICAgPHZpZXc+6L+Z6YeM5aSN546w5LiN5Ye65p2lPC92aWV3PlxuICAgICAgPG51dC11cGxvYWRlciB1cmw9XCJodHRwczovL3h4eHhcIj48L251dC11cGxvYWRlcj5cbiAgICA8L3RlbXBsYXRlPlxuICA8L251dC1jZWxsPlxuPC90ZW1wbGF0ZT4ifQ==
重现步骤
我看了当前的github和项目node_modules包的uploader的源码,上传这里的环境判断是这样的,导致我多端开发的时候,在浏览器H5进行文件上传会报错
if (Taro.getEnv() == "WEB") {
let el = document.getElementById("taroChooseImage");
if (el) {
el == null ? void 0 : el.setAttribute("accept", props.accept);
} else {
const obj = document.createElement("input");
obj.setAttribute("type", "file");
obj.setAttribute("id", "taroChooseImage");
obj.setAttribute("accept", props.accept);
obj.setAttribute("style", "position: fixed; top: -4000px; left: -3000px; z-index: -300;");
document.body.appendChild(obj);
}
}
期望的结果是什么?
是否多端不适合开发H5?
实际的结果是什么?
多端不适合开发H5
环境信息
Taro CLI 4.1.11 environment info:
System:
OS: Windows 11 10.0.26100
Binaries:
Node: 22.22.2
Yarn: 1.22.22
npm: 10.9.7
npmPackages:
@tarojs/cli: 4.1.11 => 4.1.11
@tarojs/components: 4.1.11 => 4.1.11
@tarojs/helper: 4.1.11 => 4.1.11
@tarojs/plugin-framework-vue3: 4.1.11 => 4.1.11
@tarojs/plugin-html: 4.1.11 => 4.1.11
@tarojs/plugin-platform-alipay: 4.1.11 => 4.1.11
@tarojs/plugin-platform-h5: 4.1.11 => 4.1.11
@tarojs/plugin-platform-jd: 4.1.11 => 4.1.11
@tarojs/plugin-platform-qq: 4.1.11 => 4.1.11
@tarojs/plugin-platform-swan: 4.1.11 => 4.1.11
@tarojs/plugin-platform-tt: 4.1.11 => 4.1.11
@tarojs/plugin-platform-weapp: 4.1.11 => 4.1.11
@tarojs/runtime: 4.1.11 => 4.1.11
@tarojs/shared: 4.1.11 => 4.1.11
@tarojs/taro: 4.1.11 => 4.1.11
@tarojs/vite-runner: 4.1.11 => 4.1.11
babel-preset-taro: 4.1.11 => 4.1.11
eslint-config-taro: 4.1.11 => 4.1.11
其他补充信息
No response