Skip to content

消息通知 xMsgNotice


在线预览
在线模拟尺寸:

介绍

本组件可以通过左右拖拉关闭消息,往左拉,左关闭,右拉右关闭,有阻尼回弹效果,可单独设置。

平台兼容

H5andriodIOS小程序UTSUNIAPP-X SDKversion
☑️☑️☑️☑️4.44+1.1.9

文件路径

ts

@/uni_modules/tmx-ui/components/x-msg-notice/x-msg-notice.uvue

使用

ts

<x-msg-notice></x-msg-notice>

Props 属性

名称说明类型默认值
modelValue打开和关闭状态<br>等同v-model,如果使用:modelValue将不受控.booleantrue
duration``number450
threshold当滑动时小于此值,会回弹到原位。而不执行关闭number64
round圆角,空值时取全局的drawr圆角。string""
position显示位置top,bottomstring"bottom"
offset距离边界的偏移量string"12px"
bgColor背景string"white"
darkBgColor暗黑的背景,如果不提供,读取sheetDarkColorstring""
clickClose点击组件是否关闭通知booleantrue

Events 事件

名称参数说明
click-组件点击事件
update:modelValue-等同v-model,
在使用时,要选同步关闭,再同步打开这样循环,
类似于ref方法on,off方式。

Slots 插槽

名称说明数据
default默认插槽-

Ref 方法

名称参数返回值说明

示例文件路径

json

/pages/fankui/msg-notice

示例源码

uvue
vue
<template>
	<!-- #ifdef APP -->
	<scroll-view style="flex:1">
	<!-- #endif -->
	<!-- #ifdef MP-WEIXIN -->
	<page-meta :page-style="`background-color:${xThemeConfigBgColor}`">
		<navigation-bar :background-color="xThemeConfigNavBgColor" :front-color="xThemeConfigNavFontColor"></navigation-bar>
	</page-meta>
	<!-- #endif -->
		
		<x-sheet>
			<x-text font-size="18" class=" text-weight-b mb-8">也可变量控制</x-text>
			<view class="flex flex-row flex-row-center-between">
				<x-button width="48%" @click="onClick(true)">打开底部消息条</x-button>
				<x-button width="48%" @click="onClick(false)" color="error">关闭询问消息条</x-button>
			</view>
		</x-sheet>
		<x-sheet>
			<x-text font-size="18" class=" text-weight-b mb-8">消息通知 xMsgNotice</x-text>
			<x-text color="#999999" >
				本组件可以通过左右,上下拖拉关闭消息,往向不同方向拉手势,会向指定方向关闭,有阻尼回弹效果,可单独设置。
			</x-text>
		</x-sheet>
		<x-msg-notice :model-value="true" position="top">
			<x-sheet color='primary' :margin="['0']">
				<x-text color="white" class="text-size-g text-weight-b">左右或者向上拉可关闭</x-text>
				<x-text color="white" class="text-size-m text-grey mt-10  line-8">本组件可以通过左右,上下拖拉关闭消息,往向不同方向拉手势,会向指定方向关闭,有阻尼回弹效果,可单独设置。</x-text>
			</x-sheet>
		</x-msg-notice>
		<x-msg-notice v-model="show">
			<x-sheet>
				<x-text class="text-size-g text-weight-b">消息通知 xMsgNotice</x-text>
				<x-text class="text-size-m text-grey mt-10  line-8">本组件可以通过左右,上下拖拉关闭消息,往向不同方向拉手势,会向指定方向关闭,有阻尼回弹效果,可单独设置。</x-text>
			</x-sheet>
		</x-msg-notice>
	<!-- #ifdef APP -->
	</scroll-view>
	<!-- #endif -->
</template>

<script>
	export default {
		data() {
			return {
				show: false
			};
		},
		methods: {
			onClick(isshow : boolean) {
				this.show = isshow;

			}
		},
	}
</script>

<style lang="scss">

</style>
最近更新