通知 Notify
基本使用
vue
<template>
<jp-notify ref="notifyRef" top="55px" />
<view class="ml-2 mt-2" @click="change1(0)">状态success</view>
<view class="ml-2 mt-2" @click="change1(1)">状态error</view>
<view class="ml-2 mt-2" @click="change1(2)">状态warning</view>
</template>
<script lang="ts" setup>
import { reactive } from 'vue'
const notifyRef = ref<any>('notifyRef')
const change1 = (index) => {
if (index === 0) {
notifyRef.value.show({
message:
'111111222233333这里是内容这里是内里容这里这里是内里容这里是内容这是这里是内里容这里是内容这是这里是内里容这里是内容这是这里是内里容这里是内容这是这里是内里容这里是内容这是是内容这是内容22222',
type: 'success'
})
}
if (index === 1) {
notifyRef.value.show({
message: '这里是内容这里',
type: 'error'
})
}
if (index === 2) {
notifyRef.value.show({
message: '这里是内容这里是内容这里是内容这里是内容',
type: 'warning',
duration: 5000
})
}
}
</script>
props
属性名 | 类型 | 默认值 | 描述 |
---|---|---|---|
top | String | '0px' | 提示距离顶部的距离,根据实际情况设置 |