feat(watermark): add watermark component#101
Merged
Merged
Conversation
duenyang
reviewed
Jul 19, 2024
|
|
||
| static propsType = { | ||
| alpha: Number, | ||
| content: Object, |
Contributor
There was a problem hiding this comment.
TNode类型,使用[String, Number, Object, Function]
| const offsetLeft = offset[0] || gapX / 2; | ||
| const offsetTop = offset[1] || gapY / 2; | ||
|
|
||
| effect(() => { |
| }); | ||
| }); | ||
|
|
||
| effect(() => { |
|
|
||
| stopObservation = signal(false); | ||
|
|
||
| ready(): void { |
Contributor
There was a problem hiding this comment.
此部分做了三件事,获取base64,获取style string,监听MutationObserve,建议各自单独抽取出对应的方法,不要放在一起。
Contributor
There was a problem hiding this comment.
对于 base64Url 只是为了获取 style string,不需要使用signal,ready里面的功能都不需要effect,如果想要在每次props改变时重新计算,可以使用omi的声明周期函数 https://omi.cdn-go.cn/home/latest/zh/lifecycle.html#%E7%94%A8%E6%B3%95
duenyang
reviewed
Jul 19, 2024
|
|
||
| watermarkImgRef = createRef<HTMLDivElement>(); | ||
|
|
||
| styleStr = createRef<string>(); |
Contributor
There was a problem hiding this comment.
不需要creatRef,直接this获取即可,createRef需要与dom做绑定用
duenyang
reviewed
Jul 29, 2024
| injectStyle(keyframesStyle); | ||
|
|
||
| // 水印节点的父节点 - 防删除 | ||
| createMutationObservable(typeof document !== 'undefined' ? document.body : null, (mutations) => { |
Contributor
There was a problem hiding this comment.
在uninstall的时候,需要disconnect
Contributor
duenyang
reviewed
Aug 27, 2024
|
|
||
| @tag('t-watermark') | ||
| export default class Watermark extends Component<WatermarkProps> { | ||
| static css = styleSheet; |
Contributor
|
+目前水印显示不出来,以上问题由 @duenyang 接手修复 |
This was referenced Oct 17, 2024
Closed
This was referenced Dec 16, 2024
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

🤔 这个 PR 的性质是?
🔗 相关 Issue
#33
💡 需求背景和解决方案
📝 更新日志
fix(组件名称): 处理问题或特性描述 ...
本条 PR 不需要纳入 Changelog
☑️ 请求合并前的自查清单