uni-app实现emoj表情包发送(nvue版)

uni-app实现表情包发送, vue实现思路直接使用grideview网格布局加载emoj表情包即可实现,很简单,但是nvue稍微复杂,这里采用的方案是nvue提供的组件list

看效果

代码

复制代码
<template>
	<view style="margin-right: 10rpx;margin-left: 20rpx;height: 446rpx;">
		<!--列表-->
		<list :show-scrollbar='false'>
			<!-- 注意事项: 不能使用 index 作为 key 的唯一标识 -->
			<cell v-for="(items, index) in emojData" :key="items.id">
				<view style="display: flex;flex-direction: row;">
					<block v-for="(item, index) in items">
						<view class="emoj_parent" hover-class="checkActive" hover-stay-time="100"
							@click="tuchEmoj(item,index)">
							<text @click="tuchEmoj(item,index)" class="emoj_conn">{{item}}</text>
						</view>
					</block>
				</view>

			</cell>
		</list>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				emojData: [
					['🤞', '👍', '👏', '❤', '😁', '🖐', '😀', '😃'],
					['😄', '😁', '😆', '😅', '😂', '🤣', '😊', '😇'],
					['🙂', '🙃', '😉', '😌', '😍', '🥰', '😘', '😗'],
					['😙', '😚', '😋', '😛', '😝', '😜', '🤪', '🤨'],
					['🧐', '🤓', '😎', '🤩', '🥳', '😏', '😒', '😞'],
					['😔', '😟', '😕', '🙁', '😣', '😖', '😫', '😩'],
					['🥺', '😢', '😭', '😤', '😠', '😡', '🤬', '🤯'],
					['😳', '🥵', '🥶', '😱', '😨', '😰', '😥', '😓'],
					['🤗', '🤔', '🤭', '🤫', '🤥', '😶', '😐', '😑'],
					['😬', '🙄', '😯', '😦', '😧', '😮', '😲', '😴'],
					['🤤', '😪', '😵', '🤐', '🥴', '🤢', '🤮', '🤧'],
					['😷', '🤒', '🤕', '🤑', '🤠', '👻', '🐧']
				]
			}
		},
		methods: {
			tuchEmoj: function(item, index) {
				console.log("====tuchEmoj====" + JSON.stringify(index) + "===" + item)
			}
		}
	}
</script>

<style>
	.emoj_parent {
		margin-left: 8rpx;
		margin-bottom: 5rpx;
		align-items: center;
		margin-top: 8rpx;
		padding-top: 5rpx;
		padding-bottom: 5rpx;
	}

	.checkActive {
		background-color: #e8e8e8 !important;
	}

	.emoj_conn {
		width: 80rpx;
		font-size: 56rpx;
		text-align: center;
	}
</style>
相关推荐
张风捷特烈7 分钟前
状态管理大乱斗#03 | Provider 源码全面评析
android·前端·flutter
灵感__idea6 小时前
Hello 算法:“走一步看一步”的智慧
前端·javascript·算法
吴文周7 小时前
告别重复劳动:一套插件让 AI 替你写代码、修Bug、做测试、上生产
前端·后端·ai编程
Mh8 小时前
我决定写一个 3D 地球仪来记录下我要去的地方
前端·javascript·动效
yaoxin5211238 小时前
390. Java IO API - WatchDir 示例
java·前端·python
懒狗小前端8 小时前
做了一个 codex 的中文文档网站,做的不好可以随便喷
前端·后端
. . . . .9 小时前
ref、useRef 和 forwardRef
前端·javascript·react.js
energy_DT10 小时前
2026年海上钻井平台数字孪生平台:引领海洋能源数字化转型
前端
Eric_见嘉10 小时前
在职前端 Agent 配置分享
前端·后端·agent
柚子81610 小时前
break跳出语句块的神奇技巧
前端·javascript