-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
feat(message provider): add placement prop #851
feat(message provider): add placement prop #851
Conversation
@@ -56,6 +56,7 @@ multiple-line | |||
| closable | `boolean` | All messages whether to show close icon. | | |||
| duration | `number` | `3000` | All messages's default duration. | | |||
| max | `number` | `undefined` | Limit the number of message to display. | | |||
| placement | `top \| top-left \| top-right \| bottom \| bottom-left \| bottom-right ` | `top` | All messages placement | |
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.
| placement | `top \| top-left \| top-right \| bottom \| bottom-left \| bottom-right ` | `top` | All messages placement | | |
| placement | `top \| top-left \| top-right \| bottom \| bottom-left \| bottom-right ` | `top` | All message's placement. | |
src/message/src/Message.tsx
Outdated
style={{ | ||
...(cssVars as CSSProperties), | ||
[this.placement.startsWith('top') ? 'top' : 'bottom']: '12px', | ||
left: this.placement.endsWith('left') ? '12px' : '', | ||
right: this.placement.endsWith('right') ? '12px' : '' | ||
}} |
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.
应该可以放到container上
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.
我刚开始放到container上,有些样式问题
src/message/src/styles/index.cssr.ts
Outdated
@@ -26,6 +26,7 @@ import fadeInHeightExpand from '../../../_styles/transitions/fade-in-height-expa | |||
// --border-radius | |||
export default c([ | |||
cB('message-wrapper', ` | |||
position: fixed; |
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.
不能这么弄,若干这样没办法叠加了。
我们需要改的是 container 的样式,不是 message 自身。
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.
晓得了,我改下
4745e28
to
4c5c589
Compare
CHANGELOG.en-US.md
Outdated
- `n-message-provider` add `container-style` prop | ||
- `n-message-provider` add `placement` prop. |
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.
- `n-message-provider` add `container-style` prop | |
- `n-message-provider` add `placement` prop. | |
- `n-message-provider` add `container-style` prop. | |
- `n-message-provider` add `placement` prop. |
@@ -21,10 +21,10 @@ import { defineComponent } from 'vue' | |||
|
|||
// content | |||
export default defineComponent({ | |||
setup () { | |||
setup() { |
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.
please use eslint to format it
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.
这个格式化是commit触发的钩子
现在 Message 本体的动画有问题,从上往下的时候,折叠过程中 message 按照上边缘对齐的,所以 message 的位置看起来不会有很大的 offset。但是如果从下到上,message 的动画还是按照上边缘对齐,就会往下走了。 |
确实,我处理下 |
@@ -106,10 +106,11 @@ export default defineComponent({ | |||
'--line-height': lineHeight, | |||
'--border-radius': borderRadius | |||
} | |||
}) | |||
}), | |||
placement: messageProviderProps.placement |
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.
这里不用弄成响应的吧
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.
不用,先不支持单个 message 的位置。有需求我们在加,那样会比较复杂,需要每个 placement 储存一个数组。
const messages = {
top: [],
bottom: [],
...
}
我们先暂时不做
@@ -150,7 +156,7 @@ export default defineComponent({ | |||
} | |||
}) | |||
|
|||
function createIconVNode ( | |||
function createIconVNode( |
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.
lint 有点问题,我先合了
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.
以后注意一下就行
* feat:n-input Support hidden password * feat(form): support require-mark-placement(tusen-ai#171) * Revert "feat(form): support require-mark-placement(tusen-ai#171)" This reverts commit 0627777. * Revert "feat:n-input Support hidden password" This reverts commit ea64917. * feat(message provider): add placement prop(wip) * feat(message provider): add placement prop * feat: add demo * feat: fix demo code * feat: fix code * feat: fix code * Update CHANGELOG.en-US.md * feat: fix style code
No description provided.