通知 Notice
基本使用
vue
<template>
<jp-notice text="有新的消息点击查看" :scrollable="true" :show-left-icon="true" :show-right-icon="true" :show-count="true" :count="10"></jp-notice>
</template>
背景颜色
vue
<template>
<jp-notice text="有新的消息点击查看" :scrollable="true" color="#FFA900" background-color="#FEF4E5"></jp-notice>
</template>
左侧 icon 图标
vue
<template>
<jp-notice text="800-820-8820" :show-left-icon="true" left-icon-type="jp-icon-search"></jp-notice>
</template>
右侧 icon 效果
vue
<template>
<jp-notice :ref="noticeRef" text="800-820-8820" :show-right-icon="true" right-icon-type="jp-icon-close" @right="doClose"></jp-notice>
</template>
<script lang="ts" setup>
import { ref, ComponentPublicInstance } from 'vue'
const notice = ref<any>(null)
const doClose = () => {
if (notice.value) {
notice.value.close()
}
}
const noticeRef = (el) => {
notice.value = el
}
</script>
props
属性名 | 类型 | 默认值 | 描述 |
---|---|---|---|
text | String | '' | 显示文字 |
backgroundColor | String | '#E9F0FF' | 背景颜色 |
speed | Number | 100 | 文字滚动的速度,默认 1s 滚动 100px |
color | String | '#1C64FD' | 文字颜色 |
leftIconType | String | 'hdIcon-warn-circle' | 左侧 icon |
showLeftIcon | Boolean | false | 是否显示左侧 icon |
single | Boolean | false | 是否单行 |
scrollable | Boolean | false | 是否滚动,添加后控制单行效果取消 |
count | Number | 0 | 消息数量 |
showCount | Boolean | false | 是否显示消息数量 |
rightIconType | String | 'hdIcon-arrow-right' | 右侧 icon |
showRightIcon | Boolean | false | 是否显示右侧 icon |
事件名 | 描述 |
---|---|
right | 右边 icon 点击事件 |
left | 左边 icon 点击事件 |
click | 点击事件 |