frontend/examking-app/plugins/uview-ui/components/u-top-tips/u-top-tips.vue
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<template>
<view class="u-tips" :class="['u-' + type, isShow ? 'u-tip-show' : '']" :style="{
top: navbarHeight + 'px',
zIndex: uZIndex
}">{{ title }}</view>
</template>
<script>
/**
* topTips 顶部提示
* @description 该组件一般用于页面顶部向下滑出一个提示,尔后自动收起的场景。
* @tutorial https://www.uviewui.com/components/topTips.html
* @property {String Number} navbar-height 导航栏高度(包含状态栏高度在内),单位PX
* @property {String Number} z-index z-index值(默认975)
* @example <u-top-tips ref="uTips"></u-top-tips>
*/
export default {
name: "u-top-tips",
props: {
// 导航栏高度,用于提示的初始化
navbarHeight: {
type: [Number, String],
// #ifndef H5
default: 0,
// #endif
// #ifdef H5
default: 44,
// #endif
},
// z-index值
zIndex: {
type: [Number, String],
default: ''
}
},
data() {
return {
timer: null, // 定时器
isShow: false, // 是否显示消息组件
title: '', // 组件中显示的消息内容
type: 'primary', // 消息的类型(颜色不同),primary,success,error,warning,info
duration: 2000, // 组件显示的时间,单位为毫秒
};
},
computed: {
uZIndex() {
return this.zIndex ? this.zIndex : this.$u.zIndex.topTips;
}
},
methods: {
show(config = {}) {
// 先清除定时器(可能是上一次定义的,需要清除了再开始新的)
clearTimeout(this.timer);
// 时间,内容,类型主题(type)等参数
if (config.duration) this.duration = config.duration;
if (config.type) this.type = config.type;
this.title = config.title;
this.isShow = true;
// 倒计时
this.timer = setTimeout(() => {
后面还有 61 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。