uni-app 发布媒介功能(自由选择媒介类型的内容) 设计

1.首先明确需求

我想做一个可以选择媒介的内容,来进行发布媒介的功能

(媒介包含:图片、文本、视频)

2.原型设计

发布-编辑界面

通过点击下方的加号,可以自由选择添加的媒介类型

但是因为预览中无法看到视频的效果,所以我这里就完成了添加文本和图片的效果

添加一些内容后的样子:

可以分段发布图片和文本的效果

也可以对其进行预览,这样可以观察别人浏览自己作品的场景

如果确定好了,就可以返回发布内容啦!

3.核心代码 - 抽屉效果实现

抽屉效果参考了,uniapp官网的抽屉组件

uni-app官网https://uniapp.dcloud.net.cn/component/uniui/uni-drawer.html

我改编后的具体代码如下所示:

复制代码
<template>
	<view >
		<uni-card is-full :is-shadow="false">
		</uni-card>
		<uni-section title="左侧滑出" type="line">
			<view class="example-body" >
				<wd-icon @click="showDrawer('showRight')" class="add-content" color="#ffffff" name="add" size="32rpx"></wd-icon>
				<uni-drawer class="drawer-content" ref="showRight" mode="right" :width="320" @change="change($event,'showRight')">
					<view class="close">
						<view class="add-tip" >
							<wd-icon @click="closeDrawer('showRight',-1)" name="close" size="16px"></wd-icon>
							<text>请选择添加的内容</text>
							<text></text>
						</view>
					</view>
					<view class="add-select">
						<text class="item" @click="closeDrawer('showRight',0)">图片</text>
						<text class="item" @click="closeDrawer('showRight',1)">文本</text>
					</view>
				</uni-drawer>
			</view>
		</uni-section>
	</view>
</template>


<script>
	export default {
		data() {
			return {
				showRight: false,
			}
		},
		methods: {
			
			// 打开窗口
			showDrawer(e) {
				this.$refs[e].open()
			},
			// 关闭窗口
			closeDrawer(e,index) {
				this.$refs[e].close()
				  this.$emit('custom-event', index);
			},
			// 抽屉状态发生变化触发
			change(e, type) {
				console.log((type === 'showLeft' ? '左窗口' : '右窗口') + (e ? '打开' : '关闭'));
				this[type] = e
			}
		}
		
	}
</script>

<style lang="scss" scoped>


.example-body {
	padding: 10px;
	background-color: red;
	border-radius: 10rpx;
	margin: 20rpx;
	padding: 20rpx 25rpx;
	background-color: #00e900;
	font-size: 30rpx;
	color: #282c35;
	border-radius: 40rpx;
	box-shadow: 0 0 20rpx rgba(228, 228, 228, 0.5); 
	
	.add-content{
		display: flex;
		justify-content: center;
		align-items: center;
		font-size: 20rpx;
		
	}	
	

}

.close {
	padding: 10px;
}

.add-tip{
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 30rpx;
	padding-top: 40px;
}

.drawer-content{
	display: flex;
	flex-direction: column;
	
	.add-select{
		display: flex;
		flex-direction: column;
		
		.item{
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			padding: 30rpx;
			margin: 0rpx 40rpx;
			border-bottom: #e3e3e3 solid 1rpx;
			
			&:active{
				background-color: #ececec ;
			}
		}
	}
}
</style>

4.未开发说明:

隐式设置和定时发布还未开发

相关推荐
2501_9159090619 小时前
手机崩溃日志导出的工程化体系,从系统级诊断到应用行为分析的多工具协同方法
android·ios·智能手机·小程序·uni-app·iphone·webview
郑州光合科技余经理20 小时前
技术视角:海外版一站式同城生活服务平台源码解析
java·开发语言·uni-app·php·排序算法·objective-c·生活
wangdaoyin20101 天前
UniApp中使用LivePlayer进行视频或在流媒体播放
uni-app·liveplayer·h5播放视频
2501_915106321 天前
App HTTPS 抓包实战解析,从代理调试到真实网络流量观察的完整抓包思路
网络协议·http·ios·小程序·https·uni-app·iphone
游戏开发爱好者81 天前
苹果App Store应用程序上架方式全面指南
android·小程序·https·uni-app·iphone·webview
2501_916008891 天前
深入理解 iPhone 文件管理,从沙盒结构到开发调试的多工具协同实践
android·ios·小程序·https·uni-app·iphone·webview
一室易安1 天前
解决使用 UniApp 搭配 Vue3 小程序开始 使用uview-plus 的返回顶部up-back-top中onPageScroll 不触发的问题
小程序·uni-app
yilan_n1 天前
鸿蒙应用上传
vue.js·华为·uni-app
yilan_n1 天前
【UniApp实战】手撸面包屑导航与路由管理 (拒绝页面闪烁)
前端·javascript·vue.js·uni-app·gitcode
一室易安1 天前
uniapp+vue3 微信小程序中 页面切换tab 页面滚动到指定锚点位置,滚动页面时候到达指定锚点位置吸顶tab 会自动进行切换
微信小程序·uni-app·notepad++