Uniapp-picker组件的用法、时间、日期、地区选择器等

基于uni-app的 年-月-日 时 时间日期范围控件 一个使用 uni-app 开发的日期时间选择器组件,它包含了一个遮罩层(pickerMask)和一个日期时间选择器弹窗(picker-box这个组件允许用户选择一个时间范围,包括年、月、日和小时。 阅读详情
AI摘要

本文介绍Uniapp中picker组件的使用方法,涵盖时间、日期和地区选择器的应用场景与实现方式,帮助开发者高效构建移动端表单交互功能。

1、uniapp–picker组件

<template>
	<view class="signUp">
		<view class="signUp_dv1">
			<u-form :model="form" ref="uForm" label-width="95px">
				<u-form-item label="日期" :required="true">
					<u-input v-model="form.applicantDate"  @click="applicantDate" placeholder="请输入日期"/>
					<image src="../../static/tabbar/jianyou1.png" class="imgs"  mode=""></image>
				</u-form-item>
				<u-form-item label="车型" :required="true">
					<view class="uni-list-cell-db" v-if="carList.length>0">
						<picker @change="bindPickercarType" :value="index1" :range="carList" range-key="name">
							<view>{{carList[index1].name}}</view>
						</picker>
					</view>
					<image src="../../static/tabbar/jianyou1.png" class="imgs" mode=""></image>
				</u-form-item>
				<u-form-item label="出发地" :required="true">
					<view class="uni-list-cell-db">
						<u-input v-model="form.departure" @click="departureardess"  placeholder="请输入出发地"/>
					</view>
					<image src="../../static/tabbar/jianyou1.png" class="imgs" mode=""></image>
				</u-form-item>
				<u-form-item label="目的地" :required="true">
					<view class="uni-list-cell-db">
						<u-input v-model="form.destination" @click="destinationardess"  placeholder="请输入出发地"/>
					</view>
					<image src="../../static/tabbar/jianyou1.png" class="imgs" mode=""></image>
				</u-form-item>
				
				<u-form-item label="计划用车时间" :required="true">
					<u-input v-model="form.startDate" @click="cstarttime"  placeholder="请输入计划用车时间"/>
					<image src="../../static/tabbar/jianyou1.png" class="imgs" mode=""></image>
				</u-form-item>
				<u-form-item label="预计返回时间" :required="true">
					<u-input v-model="form.endDate" @click="cendtime"  placeholder="请输入预计返回时间"/>
					<image src="../../static/tabbar/jianyou1.png" class="imgs" mode=""></image>
				</u-form-item>
				<view class="">
					<u-picker mode="time" default-time="" v-model="show" :params="params" @confirm="confirm"></u-picker>
					<u-picker mode="time" default-time="" v-model="show1" :params="params" @confirm="confirm1"></u-picker>
					<u-picker mode="time" default-time="" v-model="show2" :params="params" @confirm="confirm2"></u-picker>
					<u-picker mode="region"  v-model="show3" :params="ardessparams" @confirm="confirm3"></u-picker>
					<u-picker mode="region"  v-model="show4" :params="departureparams" @confirm="confirm4"></u-picker>
				</view>
			
				<u-form-item label="事由" :required="true">
				</u-form-item>
				<u-form-item  prop="usageReason" style="padding: 0 8px;" class="sss">
					<u-input class="JTxtArea lg" :maxlength="300" :data-maxnum="form.usageReason.length+'/300'" auto-height v-model="form.usageReason" placeholder="描述要求在300字符以内" @input="cuiinput" style="padding: 0 8px;"/>
				</u-form-item>
			</u-form>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page: 1,
				pageSize:9999,
				indexR1:0,
				carList:[],//车辆类型
				departureList:[],//出发地
				destinationList:[],//目的地
				pictures:[],
				videos:'',
				fileList:[],
				index:0,
				index1:0,
				index2:0,
				index3:0,
				index4:0,
				form: {
					title: "",//标题
					applicantName: "",//申请人
					vehicleDept:'',//申请人部门
					phone:'',//联系电话
					applicantDate:'',//申请日期
					leader:'',//带车人
					follower:'',//随行人员
					type:'',//申请车型
					departure:"",//出发地
					destination:'',//目的地
					startDate:'',//计划用车时间
					endDate:'',//预计返回时间
					usageReason:'',//用车事由
					applicantCode:'',//申请单号
				},
				deviceid:'',
				code:'',
				indexR: 0,
				rules: {
					// 可以单个或者同时写两个触发验证方式
					title: [
						{required: true,message: '请输入标题',trigger: 'blur'}
					],
					applicantName:[
						{ required: true,message: '请输入申请人',trigger: 'blur'}
					],
					vehicleDept:[
						{ required: true,message: '请输入申请部门',trigger: ['blur', 'change']	}
					],
					applicantDate:[
						{ required: true,message: '请输入申请日期',trigger: ['blur', 'change']	}
					],
					leader:[
						{ required: true,message: '请输入带车人',trigger: ['blur', 'change']	}
					],
					follower:[
						{ required: true,message: '请输入随行人员',trigger: ['blur', 'change']	}
					],
					type:[
						{ required: true,message: '请选择车型',trigger: ['blur', 'change']	}
					],
					departure:[
						{ required: true,message: '请选择出发地',trigger: ['blur', 'change']	}
					],
					destination:[
						{ required: true,message: '请选择目的地',trigger: ['blur', 'change']	}
					],
					startDate:[
						{ required: true,message: '请选择计划用车时间',trigger: ['blur', 'change']	}
					],
					endDate:[
						{ required: true,message: '请选择预计返回时间',trigger: ['blur', 'change']	}
					],
					usageReason:[
						{ required: true,message: '请输入用车事由',trigger: ['blur', 'change']	}
					],
					phone:[
						{ required: true,message: '请输入手机号',trigger: ['blur', 'change']	}
					],
					applicantCode:[
						{ required: true,message: '请输入申请单号',trigger: ['blur', 'change']	}
					],
				},
				setFocus:false,
				params: {
					year: true,
					month: true,
					day: true,
				},
				ardessparams:{
					province: true,
					city: true,
					area: true
				},
				departureparams:{
					province: true,
					city: true,
					area: true
				},
				show: false,
				show1: false,
				show2: false,
				show3: false,
				show4: false,
				showSelect:false,
				showList:[],
				subjectAarr:[0], 
			};
		},
		mounted(){
			this.getCarList();
			this.getPickerCar();
		},
		onReady() {
			this.$refs.uForm.setRules(this.rules);
		},
		onLoad(e) {
		},
		onNavigationBarButtonTap(e) {
			this.submit()
		},
		methods: {
			setBlur(){
				this.setFocus=false;  
			}, 
			selectClick(e) {
				this.setFocus=true
				console.log(e[0],'cui')
				uni.setStorageSync('productName1',  e[0].label)
				this.form.productName = e[0].label
				this.deviceid = e[0].value
			},
			 // 模糊搜索
			searchProduct(){
			//首先判断输入框是否为空
				if(this.form.productName === ''){
				//this.showList是下拉框显示的内容,如果为空就展示全部数据
					this.showList = this.listdata  
				//否则执行下面内容
				}else{
					//先清空展示的数据
					this.showList = []
					//1.前端匹配
					if(uni.getStorageSync('productName1') == this.form.productName){
						this.showList = this.listdata
					}else {
						this.showList = this.listdata.filter((item)=>{
							return item.deviceName.indexOf(this.form.productName)>=0
						})
					}
				}
				this.showSelect = true
			},
			cstarttime(){
				this.show = true
				console.log('123')
			},
			cendtime(){
				this.show1 = true
			},
			applicantDate(){
				this.show2 = true
			},
			//出发地
			departureardess(){
				this.show3 = true
			},
			//目的地
			destinationardess(){
				this.show4 = true
			},
			confirm(e){
				this.form.startDate = `${e.year}-${e.month}-${e.day} `
				console.log(this.$refs.uForm,'this.strattime')
				//this.$refs.uForm.clearValidate('startDate')//${e.hour}:${e.minute}
			},
			confirm1(e){
				console.log(e,'e')
				this.form.endDate = `${e.year}-${e.month}-${e.day} `
				//this.$refs.uForm.clearValidate('endDate')//${e.hour}:${e.minute}
			},
			confirm2(e){
				console.log(e,'e')
				this.form.applicantDate = `${e.year}-${e.month}-${e.day} `
				//this.$refs.uForm.clearValidate('applicantDate')//${e.hour}:${e.minute}
			},
			confirm3(e){
				console.log(e,'e')
				this.form.departure = `${e.province.label},${e.city.label},${e.area.label} `
				//this.$refs.uForm.clearValidate('departure')
			},
			confirm4(e){
				console.log(e,'e')
				this.form.destination = `${e.province.label},${e.city.label},${e.area.label} `
			},
			cuiinput(){
			},
			getPickerCar(){
				this.httptool.vGet(this.constApis.leader.URL+"?pageNum="+this.page+"&pageSize="+this.pageSize, {},(res) => {
					if (res.data.code == 200) {
						this.leadercarList = res.data.rows
						this.total = res.data.total
					}
					//console.log(this.leadercarList,'this.leadercarList')
				})
			},
			bindPickerCar(e){
				this.index2 = e.target.value
				//this.getPickerCar(this.leadercarList[this.index].userName)
			},
			getCarList(){
				this.httptool.vGet(this.constApis.vehiclecar.URL+"?pageNum="+this.page+"&pageSize="+this.pageSize, {},(res) => {
					if (res.data.code == 200) {
						this.carList = res.data.data
					}
				})
			},
			bindPickercarType(e){
				this.index1 = e.target.value
				//this.getCarList(this.carList[this.index1].name)
			},
			submit() {
				this.$refs.uForm.validate(valid => {
					if (valid) {
						this.postsignup()
					} else {
						console.log('验证失败');
					}
				});
			},
			postsignup(){
				let obj = {
					title:this.form.title,
					applicantName:this.form.applicantName,
					vehicleDept:this.form.vehicleDept,
					phone:this.form.phone,
					applicantDate:this.form.applicantDate,
					leader:this.leadercarList[this.index2].userName,
					follower:this.form.follower,
					type:this.carList[this.index1].name,
					departure:this.form.departure,
					destination:this.form.destination,
					startDate:this.form.startDate,
					endDate:this.form.endDate,
					applicantCode:this.form.applicantCode,
					usageReason:this.form.usageReason
				}
				this.httptool.vPost(this.constApis.vehicleadd.URL, obj,(res) => {
					if (res.data.code == 200) {
						uni.showToast({
							icon: 'none',
							title: '提交成功'
						});
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped >
	.signUp{
		// background-color: #F9F9F9;
		 //    height: 100%;
			// overflow: hidden;
			padding-bottom: 15px;
		.signUp_dv1{
			background-color: #fff;
			// height: calc(100% - 100upx);
			border-radius: 16upx;
			margin: 20upx;
			padding: 20upx 20upx;
			padding-bottom: 40px;
			// /deep/ .u-form-item{
			// 	padding-top: 0 !important;
			// }
			/deep/ .u-form-item__message{
				padding-left: 95px !important;
			}
			.sss{
				/deep/ .u-form-item__message{
					padding-left: 0px !important;
				}
			}
			/deep/ .u-form-item--left__content--required{
				left: -6px !important;
			}
			.imgs{
				width: 14px;
				height: 12px;
			}
			.fileList{
				display: flex;
				flex-wrap: wrap;
				padding: 0;
				.fileList_dv{
					width:23%;
					position: relative;
					display: inline-block;
					margin-right: 15upx;
				}
			}
			.uploader_video{
			    position: relative;
			    z-index: 1;
				margin-top: 15px;
				padding:1rpx;
				background:#000;
				border-radius: 10rpx;
				height: 140px;
				.video{
				    width: 100%;
				    height: 100%;
				}
				.photodel{
					width: 50upx;
					height: 50upx;
					position: absolute;
					right: 0px;
					top: 0px;
					background-color: rgba(0,0,0,0.4);
					.imgs{
						width: 50upx;
						height: 50upx;
					}
				}
			}
			.certif_dv{
				// margin: 0 auto;
				width: 180upx;
				height: 150upx;
				background: #FFFFFF;
				border-radius: 16upx;
				border: 1px dashed #979797;
				// margin-top: 30upx;
				
				.imgs_dv{
					// width: 88upx;
					// height: 88upx;
					// // background: #F1F1F1;
					// box-shadow: 0px 0px 12px 0px rgba(185, 185, 185, 0.2);
					// border-radius: 50%;
					margin: auto;
					margin-top: 8upx;
					.imgs{
						width: 80upx;
						height: 80upx;
						margin: 18px auto;
						display: block;
					}
					
				}
				
				.text_dv{
					font-size: 26upx;
					font-family: PingFangSC-Regular, PingFang SC;
					color: #666666;
					text-align: center;
					display: block;
					// margin-top: 10upx;
				}
				
			}
			.Photo{
				width: 180upx;
				height: 150upx;
				// border-radius: 16upx;
				display: inline-block;
			}
			.photodel{
				width: 40upx;
				height: 40upx;
				position: absolute;
				right: 0px;
				top: 0px;
				background-color: rgba(0,0,0,0.4);
				.imgs{
					width: 40upx;
					height: 40upx;
				}
			}
			.flex_s{
				justify-content: space-between;
			}
			.JTxtArea {
				background-color: #F9F9F9;
				border-radius: 5px;
				width: 100%;
				// box-sizing: border-box;
				padding: 8px;
				min-height: 60px;
				line-height: 20px;
				color: #666666;
				position: relative;
				.uni-textarea-placeholder{
					font-size: 28upx;
					color:#afabab;
				}
				&.sm{
					min-height: 30px;
				}
				&.lg{
					min-height: 100px;
				}
				&:after{
					content: attr(data-maxnum);
					position: absolute;
					right: 5px;
					bottom: 0px;
					font-size: 12px;
					color: #B9B9B9;
				}
			}
		}
	}
	.u-form-view{
		padding: 20upx;
	}
	.u-form-item{
		padding: 16upx;
	}
	.warning-item{
		padding: 15upx 0 5upx 0;
		margin: 0 40upx;
		border-bottom: 1px solid #eaeaea;
	}
	.warning-item-row{
		display: flex;
		font-size: 26upx;
	}
	.warning-item-row:nth-child(1){
		color: #0099ff;
	}
	.warning-item-row.text-color-red{
		color: #ff480b;
	}
	.item-row-icon{
		width: 30upx;
	}
</style>




  `
Uniapp-小程序简单的时间选择组件-年月日时分 uniapp小程序开发系列。本文实现一个简单时间选择控件。uniapp用个心仪时间控件真的麻烦。官方给得要么年月日,要么时分。产品只要年月日时分。这该怎么玩。旧项目没有引入ui框架,我也不想去引入,不然高低整一个vant 小程序版的。uniapp生态中,有个插件市场,找了一通,是有时间控件。但是引入也是麻烦。没必要。下文基于网友给的案例再稍微改了改。对了 这是vue2 的。以上就是今天要讲的内容,本文讨论了用uniapp 实现小程序时间选择组件 仅仅支持 年月日时分 的简单版本。 阅读详情

相关推荐

从‘月份选择’这个小需求,聊聊UniApp开发中容易被忽略的Picker细节与避坑指南

本文深入探讨了UniApp开发中月份选择器的实现细节与常见问题,重点解析了picker组件的fields属性使用、跨平台兼容性处理以及日期格式转换技巧。通过实际案例和代码示例,帮助开发者避免在实现月份选择功能时遇到的典型陷阱,提升应用在不同端的用户体验一致性。

weixin_30861797的博客 438

uniapp中的picker选择器

array: [{ name: '中国' }, { name: '美国' }, { name: '巴西' }, { name: '日本' }],this.multiArray[2] = ['北京', '上海', '广州'];multiArray: [['亚洲', '欧洲'], ['中国', '日本'], ['北京', '上海', '广州']],this.multiArray[2] = ['北京', '上海', '广州'];this.multiArray[1] = ['中国', '日本'];

叶落无痕的博客 2万+

uniapp跨端日期切换避坑指南:时间戳+setDate安全方案

日期操作是前端开发的基础能力,其核心在于理解JavaScript Date对象的本质——它本质是一个毫秒时间戳与本地时区渲染的组合体。跨端场景下,字符串解析差异、夏令时偏移、时区隐式转换、Vue响应式限制等问题会集中爆发。本文聚焦uniapp多端一致性难题,以时间戳为唯一可信数据源,结合setDate日历语义加减、计算属性驱动视图、防抖节流交互优化等工程实践,系统性解决微信小程序、H5、iOS/Android App中‘点击切换日期’的稳定性问题,覆盖日期格式兼容、DST处理、视图响应失效、组件化复用等真实

weixin_28704239的博客 253

《uni-app》表单组件-Picker组件

picker,选择器组件,该组件为一个复合组件,它内置了 五种选择器,分别为:普通选择器,多列选择器,时间选择器,日期选择器,省市区选择器; 选择器在表单组件中同样属于使用频率非常高的一种,常见的业务场景包括,注册时的地区选择,日期选择,时间选择等等;

Oliver尹的博客 7993

uniapp开发小程序—picker结合后台数据实现二级联动的选择

uniapp开发小程序—picker结合后台数据实现二级联动的选择。

weixin_48596030的博客 3086

具身智能的建模和方法(具身智能入门一)

本文以机械臂将小红方块移动到目标位置为例对具身智能的建模和方法进行介绍,如下图所示,该例子来自https://ai-workshops.github.io/building-and-working-in-environments-for-embodied-ai-cvpr-2022/。

weixin_39699362的博客 1487

关于uniapp的picker的使用

最近入职的一家公司是基于uniapp开发app的,很多东西不懂,最近遇到一个关于picker选择的问题 要求二级联动,左边选择省份,右边选择市 但是picker的原生的选择只有 这样的三级联动,没有选择省然后再选择市这样单独选择的模式 然后我去uniapp的官网查看了 picker的描述和属性: mode属性: 它有五个属性值 mode = selector 表示普通选择器 属性名...

qq_44984407的博客 3万+

ThinkAdmin后台Getshell

通过文件包含或者图片马的方式Getshell。修改其可允许的文件类型,php不允许,可添加。系统管理->系统参数配置->本地服务器存储。

hot_milk1的博客 1889

uniapp中使用picker-view选择时间

picker-view 是 UniApp 中用于展示和选择数据的组件。它适用于创建多列选择器,类似于 iOS 和 Android 系统中的选择器视图。以下是 picker-view 的详细介绍,包括用法、属性和事件。

qq_48763502的博客 2079

CH32V IAP跳转避坑指南:为什么你的APP跳不过去?从mstatus寄存器配置到函数属性详解

本文深入解析CH32V系列MCU的IAP跳转机制,从mstatus寄存器配置到函数属性优化,详细讲解如何避免APP跳转失败。文章涵盖地址准备、模式切换、跳转执行等关键步骤,并提供调试技巧与实战案例,帮助开发者快速解决CH32V IAP跳转中的常见问题。

weixin_30955617的博客 144

【无人机设计与控制】基于PID控制的四旋翼无人机系统Matlab仿真

本文设计并仿真了基于PID控制的四旋翼无人机系统。首先,建立了四旋翼无人机的数学模型,涵盖了无人机的动力学和控制系统。通过PID控制器对四旋翼的姿态和位置进行控制,以实现其稳定飞行。使用MATLAB/Simulink对该系统进行仿真,验证了PID控制算法在四旋翼控制中的有效性。仿真结果表明,PID控制能够较好地调节四旋翼的飞行姿态,并有效抑制外部干扰,使得无人机能够保持平稳飞行。

2401_84610415的博客 1809

uni-app使用picker的多种选择器(多列,时间,地区)

picker底部滚动选择器 <template> <view> <view> <picker :range="years" @change="yearChange"> {{ years[yearsIndex] }} </picker>...

世 间 尤 物,不 敢 妄 取 2万+

物联网组网技术优缺点对比:蓝牙、LoRa、wifi、NB-IoT、ZigBee等

1.前言 最近对物联网产品自组网技术选型,找到合适的组网技术,让产品自行组网并完成数据的传输。 2.参数对比

谁念西风独自凉 4万+

picker封装 uniapp_表单组件 - picker - 《uni-app 组件文档》 - 书栈网 · BookStack

picker从底部弹起的滚动选择器,现支持五种选择器,通过mode来区分,分别是普通选择器,多列选择器,时间选择器,日期选择器,省市区选择器,默认是普通选择器。普通选择器mode = selector属性说明属性名类型默认值说明rangeArray / Array<Object>[]mode为 selector 或 multiSelector 时,range 有效range-keyString当 ...

weixin_39895096的博客 876

ElectrolyteGPT:首个电池电解液逆向设计的生成式 AI 系统 —— 算法原理与复现解析

数据驱动的重要性:1100 万→100 万的精心筛选,比单纯增大模型更有效领域适配:fLine 表示法、正则分词、化学感知的数据增强(SMILES randomization)都是关键小模型的力量:6M 参数在特定化学空间的表现,远超通用大模型在相同任务上的零样本能力条件生成的极限:10 维条件导致模型崩溃,提示我们需要更好的条件编码策略(如 diffusion guidance、RLHF-style 偏好优化)未来方向配方实验验证。

ASKCOS博客 133

Simulink仿真模块 - Data Type Conversion

Data Type Conversion将输入信号转换为指定的数据类型 在仿真库中的位置为: Simulink / 常用模块 Simulink / Signal Attributes 模型为: 说明 DataTypeConversion模块可将任何 Simulink®数据类型的输入信号转换为您指定的数据类型。 注意 要通过指定模块参数来控制输出数据类型,或者要从下游模块继承数据类型,使用DataTypeConversion模块。要...

jk_101的博客 2530

uniapp-form表单(2)----picker、picker-view、radio

Picker支持五种选择器,通过mode来区分,分别是普通选择器,多列选择器,时间选择器,日期选择器,省市区选择器,默认是普通选择器。**注意:**nvue页面子节点未继承 picker-view 的选中框的高度,需要自己设置高度并居中。中,其子节点的高度会自动设置成与 picker-view 的选中框的高度一致。当需要对自定义选择的弹出方式和UI表现时,往往需要使用。写一个picker-view的年月日选择器。组件,其他节点不会显示。的子组件,仅可放置于。单项选择器,内部由多个。

m0_75047254的博客 3066

24、手机GPS天线设计与有源GNSS天线性能评估

本文系统介绍了手机GPS天线的代表性设计,包括隔离磁偶极子、共面平衡偶极子和小型陶瓷加载QHA天线,分析了其结构特点、性能参数及适用场景。同时详细阐述了有源GNSS天线的组成结构与G/T比作为关键性能指标的评估方法,并提出了组件选择、噪声控制和增益提升等优化策略。最后展望了未来手机GPS天线在小型化、多频集成和智能适应性方面的发展趋势。

pytorch8learner的博客 748

TDesign MiniProgram Picker 选择器组件完全指南:API 详解、事件机制与联级联动实践

`Picker 选择器` 是 TDesign MiniProgram(tdesign-miniprogram)中负责「从一组预设数据中做出选择」的核心表单类组件,广泛用于城市选择、日期时间段选择、省市区联级联动等典型移动端场景。本文以仓库中 [Picker 官方 API 文档](https://link.gitcode.com/i/d939ef9d5f64f0a9ad9014db786e963e)

gitblog_00165的博客 1050

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

uniapp uview1.0x 下拉选择fs-select,日期下拉选择u-picker 组件简单分装

uview组件 下拉 和 日期简单分装 u-select封装 <!-- 点击弹窗下拉选择 可 单/多 列--> <template> <view> <u-input input-align="right" :placeholder="`请选择 ${placeholder}`" v-model="valueLable" type="select" :select-open="show" @click="show = true" :border="border"

weixin_46211267的博客 6829

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

uni-app x picker 组件完全指南:五种选择器模式的实战配置与事件处理

`picker` 是 uni-app x 提供的"从底部弹起的滚动选择器",通过 `mode` 属性可切换为普通选择器(selector)、多列选择器(multiSelector)、时间选择器(time)、日期选择器(date)和省市区选择器(region)五种形态,默认是普通选择器。本文以 [docs/component/picker.md](https://link.gitcode.com/i

gitblog_00501的博客 743

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

uniapp-uView表单中如何添加日期控件?

环境:uniapp,uview-ui,Picker 选择器, 本次我们用uview中的Picker 选择器来写一个日期功能 此选择器有四种弹出模式 一是时间模式,可以配置年,日,月,时,分,秒参数 二是地区模式,可以配置省,市,区参数 三是单列模式 四是多列模式 基本使用: 通过mode参数设置为time、region、selector、multiSelector,区分时间、地区、单列,多列模式。 通过v-model双向绑定一个值为布尔值的变量,来打开或者收起picker。 <tem

青茶 4775

别再只用年月日了!UniApp Picker组件实现‘仅选月份’的3种实战方案与避坑指南

本文深入探讨了UniApp中实现'仅选月份'的三种专业方案,包括官方fields属性、自定义弹出层和第三方UI库整合。针对时间日期选择器的特殊需求,提供了详细的代码示例和避坑指南,帮助开发者快速实现高效、美观的月份选择器组件,提升用户体验。

weixin_30420305的博客 457

uniapp实战:uview Picker选择器的5种高级用法(附完整代码)

本文详细介绍了uniapp中uView Picker选择器的5种高级用法,包括多列联动、自定义选项、异步数据加载、时间日期选择和UI定制。通过完整代码示例,帮助开发者掌握这一强大组件库的应用技巧,提升移动端开发效率。

sun99的博客 152

picker封装 uniapp_GitHub - jizhigang/uni-picker-view: uni-app嵌入页面的选择器

uni-picker-viewuni-app嵌入页面的选择器我需要实现的几点为:默认显示当前时间超过当前时间的日期不显示要显示有效日期一、页面布局与数据template选择器{{item}}年{{item}}月{{item}}日数据源data() {const date = new Date()const years = []const year = date.getFullYear()const...

weixin_39816362的博客 178

uni-app | 封装一个二级国内城市选择器(citypicker)

uni-app | 封装一个二级国内城市选择器(citypicker) 在实际uniapp,微信小程序,h5的项目中,经常用到picker 官方的定义:从底部弹起的滚动选择器。支持五种选择器,通过mode来区分,分别是普通选择器,多列选择器,时间选择器,日期选择器,省市区选择器,默认是普通选择器。 一共有5种模式,有满足用户需求的省市区选择器。 再看看该模式的文档 我们可以看到兼容性来说,还是不太好。而且只能是三级,与实际需求不太符合,那这样我们就来自己基于原生的picker封装一个二级citypicke

我不喜欢打代码的博客 1914
上一篇: Vue中使用el-transfer渲染接口数据
下一篇: Vue中引入SuperMap超图
时间的情敌
时间的情敌 新星创作者: 前端开发技术领域 新星创作者: 前端开发技术领域
博客等级 码龄11年 6755粉丝 220原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

时间的情敌

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值