<template>
	<view>
		<view class="search">
			<uni-search-bar placeholder="搜索" @confirm="search" :focus="true" v-model="searchValue" @blur="blur" @focus="focus"
				@input="input" @cancel="cancel" cancelButton="none" @clear="clear">
			</uni-search-bar>
		</view>
		<ws-chat :list="list"></ws-chat>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				searchValue: '',
				list: [{
					userId: 1,
					nickname: '张三',
					avatar: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png',
					note: '您收到一条消息',
					badge: 99,
					to: '/package/order/order',
					createTime: '2023-12-12'
				}, {
					userId: 2,
					nickname: '李四',
					avatar: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png',
					note: '您收到一条消息',
					badge: 'dot',
					createTime: '2023-12-12'
				}, {
					userId: 3,
					nickname: '王五',
					avatar: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png',
					note: '您收到一条消息',
					badge: 5,
					createTime: '2023-12-12'
				}]
			}
		},
		methods: {
			search(res) {
				uni.showToast({
					title: '搜索：' + res.value,
					icon: 'none'
				})
			},
			input(res) {
				console.log('----input:', res)
			},
			clear(res) {
				uni.showToast({
					title: 'clear事件，清除值为：' + res.value,
					icon: 'none'
				})
			},
			blur(res) {
				uni.showToast({
					title: 'blur事件，输入值为：' + res.value,
					icon: 'none'
				})
			},
			focus(e) {
				uni.showToast({
					title: 'focus事件，输出值为：' + e.value,
					icon: 'none'
				})
			},
			cancel(res) {
				uni.showToast({
					title: '点击取消，输入值为：' + res.value,
					icon: 'none'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.search{
		background-color: #ffffff;
	}
</style>