feat(Notify): support line-break charactor (#2045)

This commit is contained in:
neverland 2019-09-18 16:11:58 +08:00 committed by GitHub
parent 4601f77c5c
commit 774d5d7897
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 10 deletions

View File

@ -76,16 +76,16 @@ Notify({
## API ## API
### Props ### Options
| 参数 | 说明 | 类型 | 默认值 | 版本 | | 参数 | 说明 | 类型 | 默认值 | 版本 |
|-----------|-----------|-----------|-------------|-------------| |-----------|-----------|-----------|-------------|-------------|
| type | 类型,可选值为 `primary` `info` `warning` | *string* | `danger` | - | | type | 类型,可选值为 `primary` `info` `warning` | *string* | `danger` | 1.0.0 |
| message | 展示文案 | *string* | - | - | | message | 展示文案,支持通过`\n`换行 | *string* | 1.0.0 | - |
| duration | 持续时间 | *number* | `3000` | - | | duration | 展示时长(ms),值为 0 时notify 不会消失 | *number* | `3000` | - |
| selector | 自定义节点选择器 | *string* | `van-notify` | - | | selector | 自定义节点选择器 | *string* | `van-notify` | - |
| color | 字体颜色 | *string* | `#fff` | - | | color | 字体颜色 | *string* | `#fff` | - |
| background | 背景色 | *string* | - | - | | background | 背景色 | *string* | - | - |
| context | 选择器的选择范围,可以传入自定义组件的 this 作为上下文 | *object* | 当前页面 | - | | context | 选择器的选择范围,可以传入自定义组件的 this 作为上下文 | *object* | 当前页面 | - |
| safe-area-inset-top | 是否留出顶部安全距离(状态栏高度) | *boolean* | `false` | - | | safe-area-inset-top | 是否留出顶部安全距离(状态栏高度) | *boolean* | `false` | - |
| onClick | 点击时的回调函数 | *Function* | - | - | | onClick | 点击时的回调函数 | *Function* | - | - |

View File

@ -9,7 +9,6 @@
font-size: @notify-font-size; font-size: @notify-font-size;
line-height: @notify-line-height; line-height: @notify-line-height;
text-align: center; text-align: center;
word-break: break-all;
&--primary { &--primary {
background-color: @notify-primary-background-color; background-color: @notify-primary-background-color;

View File

@ -3,9 +3,8 @@
show="{{ show }}" show="{{ show }}"
custom-class="van-notify van-notify--{{ type }}" custom-class="van-notify van-notify--{{ type }}"
custom-style="background:{{ background }}; color: {{ color }}; z-index: {{ zIndex }};" custom-style="background:{{ background }}; color: {{ color }}; z-index: {{ zIndex }};"
bind:tap="onTap"
> >
<view bind:tap="onTap"> <view wx:if="{{ safeAreaInsetTop }}" style="padding-top: {{ statusBarHeight }}px"></view>
<view wx:if="{{ safeAreaInsetTop }}" style="padding-top: {{ statusBarHeight }}px"></view> <text>{{ message }}</text>
{{ message }}
</view>
</van-transition> </van-transition>