b2nil / taro-ui-vue3

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

feat(image-picker): 增加组件上传状态功能以及 demo 展示 #86

Closed unforesndprson closed 3 years ago

unforesndprson commented 3 years ago

image-picker 的File增加两个字段控制上传状态的展示: status?: "uploading" | "failed" | "done" message?: string

b2nil commented 3 years ago

感谢 PR!

关于定义文件里面的 version @since v2.0.2,目前版本号来自 Taro UI 以前的 legacy code。 现在要在写从哪个版本开始支持 PR 所涉及的功能时, 请写 taro-ui-vue3 最新的版本,目前是 1.0.0-alpha18

关于这个 PR,新增的两个字段,statusmessage 具体是如何更新的?需要在 Taro.chooseImageonSuccessonFail 回调函数里面来更新吗?

unforesndprson commented 3 years ago

感谢 PR!

关于定义文件里面的 version @since v2.0.2,目前版本号来自 Taro UI 以前的 legacy code。 现在要在写从哪个版本开始支持 PR 所涉及的功能时, 请写 taro-ui-vue3 最新的版本,目前是 1.0.0-alpha18

关于这个 PR,新增的两个字段,statusmessage 具体是如何更新的?需要在 Taro.chooseImageonSuccessonFail 回调函数里面来更新吗?

开发者增加图片上传时,可更新 files中status和message展示对应上传状态,和chooseImage的状态无关。

b2nil commented 3 years ago

所以要上传图片才能看到相应的效果吗? 可否增加新增功能的 test cases? 另外可否新增可以看到 loading / failed 状态的 demo ? 现在这个 demo 我跑了一下,好像没法辨别状态。

unforesndprson commented 3 years ago

@b2nil 最新dev分支执行yarn dev:weapp 会报错

b2nil commented 3 years ago

报什么错误?

unforesndprson commented 3 years ago

Module not found: Can't resolve './img.json' in 'taro-ui-vue3/lib/components/toast' 编译完/lib/components/toast下的img.json=>img.js

b2nil commented 3 years ago

hi @unforesndprson 看一下你的 local repo 是不是同步了最新的内容。 如果是的话,应该有一个 build 目录,里面写了采用 esbuild 快速编译开发用的库的脚本。其中有一个文件https://github.com/b2nil/taro-ui-vue3/blob/dev/build/esbuild.build.js,这里面有个ToastPlugin插件是负责把 img.json 更换为 img.js 的。

我在本地是能顺利编译的。

b2nil commented 3 years ago

@unforesndprson 当然也可以直接把 package.json 里面的 scripts 改为: "dev:weapp": "taro build --type weapp --watch", 直接跑。 但是采用这种方式,要把 config/index.js 中的第 24 行 'taro-ui-vue3$': path.resolve(__dirname, '..', 'lib'), 注释掉。

unforesndprson commented 3 years ago

看一下你的 local repo 是不是同步了最新的内容。

esbuild.build.js 中的filter: /toast\index.ts$/ 改成filter: /toast\/index.ts$/ 就正常了,你本地代码用filter: /toast\index.ts$/ 可以编译?

b2nil commented 3 years ago

Okay, 这应该是一个路径的 bug,我一直在 windows 上使用 bash 来编译的,没有问题。

unforesndprson commented 3 years ago

所以要上传图片才能看到相应的效果吗? 可否增加新增功能的 test cases? 另外可否新增可以看到 loading / failed 状态的 demo ? 现在这个 demo 我跑了一下,好像没法辨别状态。

已更新,再看一下哈

unforesndprson commented 3 years ago

另外迁移到vue3,测试案例没有更新成响应式数据。测试跑起来也有很多错误。

b2nil commented 3 years ago

@unforesndprson 抱歉,这周忙别的事情去了,还没跑这个 demo。 关于测试,主要是现在很多组件的测试没更新完,确实还有一些问题。 针对单个组件的测试,可修改 jest.config.js 里面的 roots: ['<rootDir>/src/components'],例如,改为: roots: ['<rootDir>/src/components/image-picker'],这样就只会运行 image-picker 组件的测试。

b2nil commented 3 years ago

@unforesndprson
Hi Zoney, thanks for the patient work and sorry for the delay. I just added two minor commits to this PR. Please check if there is anything else you would like to add or revise.

If you are happy with all the progress now, I'll be glad to merge it today.

unforesndprson commented 3 years ago

@b2nil Thanks good enough