-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: signature #1080
refactor: signature #1080
Conversation
src/packages/signature/demo.scss
Outdated
@@ -1,3 +1,13 @@ | |||
.demo-tips { | |||
color: #1a1a1a; | |||
.demo { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以给 signarure 一个单独的 className,.demo 的样式有可能影响其他组件的展示
src/packages/signature/demo.taro.tsx
Outdated
|
||
const signatureRef = useRef<signatureRefState>(null) | ||
const signatureRef1 = useRef<signatureRefState>(null) | ||
|
||
const confirm = (dataurl: string) => { | ||
console.log('图片地址', dataurl) | ||
// Taro.saveImageToPhotosAlbum({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
注释可以删掉
@@ -94,18 +94,19 @@ export default App; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API 需要改为组件名称 Signature
src/packages/signature/doc.en-US.md
Outdated
|
||
| Property | Description | Type | | ||
| --- | --- | --- | | ||
| confirm | 确认签字 | `() => void` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需要翻译
@@ -1,16 +1,4 @@ | |||
@import '../button/button'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
button 在组件中没有用到的话,可以不 import button 的样式文件。在 demo 中用到的 button 组件,也不需要在这里 import button 的样式文件
import Button from '@/packages/button/index.taro' | ||
import bem from '@/utils/bem' | ||
import { useConfig } from '@/packages/configprovider/configprovider.taro' | ||
import { BasicComponent, ComponentDefaults } from '@/utils/typings' | ||
|
||
interface FileType { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个类型可以在 index 文件中导出
src/packages/signature/signature.tsx
Outdated
export interface SignatureProps { | ||
type: string | ||
export interface SignatureProps extends BasicComponent { | ||
type: 'png' | 'jpg' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以像 taro 文件中,声明一个同名的类型,在 index 中导出
src/packages/signature/signature.tsx
Outdated
className: string | ||
confirm?: (canvas: HTMLCanvasElement, dataurl: string) => void | ||
clear?: () => void | ||
unsupported: string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的类型是不是能改成 ReactNode,如果改为 ReactNode ,下面代码中用到的 unsupported 的地方需要做类型判断,来兼容默认值
src/packages/signature/signature.tsx
Outdated
<p className={`${b('unsopport')}`}> | ||
{locale.signature.unSupportTpl || unSupportTpl} | ||
<p className={`${classPrefix}__unsopport}`}> | ||
{locale.signature.unsupported || unsupported} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个逻辑写反了,使用语言包, 默认值那块可以设置为空
Codecov Report
@@ Coverage Diff @@
## next #1080 +/- ##
=======================================
Coverage ? 69.58%
=======================================
Files ? 187
Lines ? 7589
Branches ? 2189
=======================================
Hits ? 5281
Misses ? 2089
Partials ? 219 |
🤔 这个变动的性质是?
🔗 相关 Issue
💡 需求背景和解决方案
☑️ 请求合并前的自查清单