tui-datetime组件由弹窗显示改成页面直接展示

效果图
在这里插入图片描述
代码

<template>
	<view class="tui-datetime-picker" :style="{zIndex}">
		<view class="tui-datetime__header" :class="{ 'tui-show': isShow }" :style="{zIndex:getPickerZIndex}">
			<view class="tui-date-header" :style="{ backgroundColor: unitBackground }" v-if="unitTop">
				<view class="tui-date-unit" v-if="type < 4 || type == 7 || type==8">年</view>
				<view class="tui-date-unit" v-if="(type < 4 && type>0) || type == 7 || type==8">月</view>
				<view class="tui-date-unit" v-if="type == 1 || type == 2 || type == 7 || type==8">日</view>
				<view class="tui-date-unit" v-if="type == 1 || type == 4 || type == 5 || type == 7 || type==8">时</view>
				<view class="tui-date-unit" v-if="(type == 1 || type > 3) && type!=8">分</view>
				<view class="tui-date-unit" v-if="type > 4 && type !=8">秒</view>
			</view>
			<view @touchstart.stop="pickerstart" class="tui-date__picker-body"
				:style="{ backgroundColor: bodyBackground,height:height+'rpx' }">
				<picker-view :key="type" :immediate-change="immediate" :value="value" @change="change"
					class="tui-datetime__picker-view">
					<picker-view-column v-if="type < 4 || type == 7 || type==8">
						<view class="tui-date__column-item" :class="{ 'selectedText': index === value[0], 'tui-font-size_32': !unitTop && type == 7 }"
							v-for="(item, index) in years" :key="index">
							{{ item }}
							<text class="tui-date__unit-text" v-if="!unitTop">年</text>
						</view>
					</picker-view-column>
					<picker-view-column v-if="(type < 4 && type>0) || type == 7 || type==8">
						<view class="tui-date__column-item" :class="{ 'selectedText': index === value[1], 'tui-font-size_32': !unitTop && type == 7 }"
							v-for="(item, index) in months" :key="index">
							{{ formatNum(item) }}
							<text class="tui-date__unit-text" v-if="!unitTop">月</text>
						</view>
					</picker-view-column>
					<picker-view-column v-if="type == 1 || type == 2 || type == 7 || type==8">
						<view class="tui-date__column-item" :class="{ 'selectedText': index === value[2], 'tui-font-size_32': !unitTop && type == 7 }"
							v-for="(item, index) in days" :key="index">
							{{ formatNum(item) }}
							<text class="tui-date__unit-text" v-if="!unitTop">日</text>
						</view>
					</picker-view-column>
					<picker-view-column v-if="type == 1 || type == 4 || type == 5 || type == 7 || type==8">
						<view class="tui-date__column-item" :class="{ 'selectedText': index === value[3], 'tui-font-size_32': !unitTop && type == 7 }"
							v-for="(item, index) in hours" :key="index">
							{{ formatNum(item) }}
							<text class="tui-date__unit-text" v-if="!unitTop">时</text>
						</view>
					</picker-view-column>
					<picker-view-column v-if="(type == 1 || type > 3)  && type!=8">
						<view class="tui-date__column-item" :class="{ 'selectedText': index === value[4], 'tui-font-size_32': !unitTop && type == 7 }"
							v-for="(item, index) in minutes" :key="index">
							{{ formatNum(item) }}
							<text class="tui-date__unit-text" v-if="!unitTop">分</text>
						</view>
					</picker-view-column>
					<picker-view-column v-if="type > 4 && type!=8">
						<view class="tui-date__column-item" :class="{ 'selectedText': index === value[5], 'tui-font-size_32': !unitTop && type == 7 }"
							v-for="(item, index) in seconds" :key="index">
							{{ formatNum(item) }}
							<text class="tui-date__unit-text" v-if="!unitTop">秒</text>
						</view>
					</picker-view-column>
				</picker-view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'tuiDatetime',
		emits: ['cancel', 'confirm'],
		props: {
			//0-年 1-日期+时间(年月日+时分) 2-日期(年月日) 3-日期(年月) 4-时间(时分) 5-时分秒 6-分秒 7-年月日 时分秒 8-年月日+小时
			type: {
				type: [Number, String],
				default: 1
			},
			//年份区间
			startYear: {
				type: Number,
				default: 1980
			},
			//年份区间
			endYear: {
				type: Number,
				default: 2050
			},
			hoursData: {
				type: Array,
				default () {
					return []
				}
			},
			minutesData: {
				type: Array,
				default () {
					return []
				}
			},
			secondsData: {
				type: Array,
				default () {
					return []
				}
			},
			//显示标题
			title: {
				type: String,
				default: ''
			},
			//标题字体大小
			titleSize: {
				type: [Number, String],
				default: 34
			},
			//标题字体颜色
			titleColor: {
				type: String,
				default: '#333'
			},
			//"取消"字体颜色
			cancelColor: {
				type: String,
				default: '#888'
			},
			//"确定"字体颜色
			color: {
				type: String,
				default: ''
			},
			//设置默认显示日期 2019-08-01 || 2019-08-01 17:01 || 2019/08/01
			setDateTime: {
				type: String,
				default: ''
			},
			//单位置顶
			unitTop: {
				type: Boolean,
				default: false
			},
			//圆角设置
			radius: {
				type: Boolean,
				default: false
			},
			//头部背景色
			headerBackground: {
				type: String,
				default: '#fff'
			},
			//根据实际调整,不建议使用深颜色
			bodyBackground: {
				type: String,
				default: '#fff'
			},
			//单位置顶时,单位条背景色
			unitBackground: {
				type: String,
				default: '#fff'
			},
			height: {
				type: [Number, String],
				default: 520
			},
			//点击遮罩 是否可关闭
			maskClosable: {
				type: Boolean,
				default: true
			},
			zIndex: {
				type: [Number, String],
				default: 998
			}

		},
		data() {
			let immediate = true;
			// #ifdef MP-TOUTIAO
			immediate = false
			// #endif
			return {
				immediate,
				isShow: true,
				years: [],
				months: [],
				days: [],
				hours: [],
				minutes: [],
				seconds: [],
				year: 0,
				month: 0,
				day: 0,
				hour: 0,
				minute: 0,
				second: 0,
				startDate: '',
				endDate: '',
				value: [],
				isEnd: true,
				firstShow: true
			};
		},
		mounted() {
			this.$nextTick(() => {
				setTimeout(() => {
					this.initData();
				}, 20)
			})
		},
		computed: {
			yearOrMonth() {
				return `${this.year}-${this.month}`;
			},
			propsChange() {
				return `${this.type}-${this.startYear}-${this.endYear}-${this.hoursData}-${this.minutesData}-${this.secondsData}`;
			},
			getColor() {
				return this.color || (uni && uni.$tui && uni.$tui.color.primary) || '#5677fc';
			},
			getMaskZIndex() {
				return Number(this.zIndex) + 1
			},
			getPickerZIndex() {
				return Number(this.zIndex) + 2
			}
		},
		watch: {
			yearOrMonth() {
				this.setDays();
			},
			propsChange() {
				this.$nextTick(() => {
					setTimeout(() => {
						this.initData();
					}, 20);
				})
			},
			setDateTime(val) {
				if (val && val !== true) {
					setTimeout(() => {
						this.initData();
					}, 20);
				}
			}
		},
		methods: {
			stop() {},
			formatNum: function(num) {
				return num < 10 ? '0' + num : num + '';
			},
			generateArray: function(start, end) {
				return Array.from(new Array(end + 1).keys()).slice(start);
			},
			getIndex: function(arr, val) {
				if (!arr || arr.length === 0) return 0;
				let index = arr.indexOf(val);
				return ~index ? index : 0;
			},
			getCharCount(str) {
				let regex = new RegExp('/', 'g');
				let result = str.match(regex);
				return !result ? 0 : result.length;
			},
			//日期时间处理
			initSelectValue() {
				let fdate = ''
				if (this.setDateTime && this.setDateTime !== true) {
					fdate = this.setDateTime.replace(/\-/g, '/');
					if (this.type == 3 && this.getCharCount(fdate) === 1) {
						fdate += '/01'
					} else if (this.type == 0) {
						fdate += '/01/01'
					}
					fdate = fdate && fdate.indexOf('/') == -1 ? `2023/01/01 ${fdate}` : fdate;
				}
				let time = null;
				if (fdate) time = new Date(fdate);
				else time = new Date();
				this.year = time.getFullYear();
				this.month = time.getMonth() + 1;
				this.day = time.getDate();
				this.hour = time.getHours();
				this.minute = time.getMinutes();
				this.second = time.getSeconds();
				this.selectResult()
			},
			initData() {
				this.initSelectValue();
				const type = Number(this.type)
				switch (type) {
					case 0:
						this.setYears();
						break;
					case 1:
						this.setYears();
						this.setMonths();
						this.setDays();
						this.setHours();
						this.setMinutes();
						break;
					case 2:
						this.setYears();
						this.setMonths();
						this.setDays();
						break;
					case 3:
						this.setYears();
						this.setMonths();
						break;
					case 4:
						this.setHours();
						this.setMinutes();
						break;
					case 5:
						this.setHours();
						this.setMinutes();
						this.setSeconds();
						break;
					case 6:
						this.setMinutes();
						this.setSeconds();
						break;
					case 7:
						this.setYears();
						this.setMonths();
						this.setDays();
						this.setHours();
						this.setMinutes();
						this.setSeconds();
						break;
					case 8:
						this.setYears();
						this.setMonths();
						this.setDays();
						this.setHours();
						break;
					default:
						break;
				}
				this.$nextTick(() => {
					setTimeout(() => {
						this.setDefaultValues();
					}, 0)
				})
			},
			setDefaultValues() {
				let vals = []
				// 1-年月日+时分 2-年月日 3-年月 4-时分 5-时分秒 6-分秒 7-年月日 时分秒 8-年月日+小时
				const year = this.getIndex(this.years, this.year);
				const month = this.getIndex(this.months, this.month)
				const day = this.getIndex(this.days, this.day)
				const hour = this.getIndex(this.hours, this.hour)
				const minute = this.getIndex(this.minutes, this.minute)
				const second = this.getIndex(this.seconds, this.second)
				const type = Number(this.type)
				switch (type) {
					case 0:
						vals = [year]
					case 1:
						vals = [year, month, day, hour, minute]
						break;
					case 2:
						vals = [year, month, day]
						break;
					case 3:
						vals = [year, month]
						break;
					case 4:
						vals = [hour, minute]
						break;
					case 5:
						vals = [hour, minute, second]
						break;
					case 6:
						vals = [minute, second]
						break;
					case 7:
						vals = [year, month, day, hour, minute, second]
						break;
					case 8:
						vals = [year, month, day, hour]
						break;
					default:
						break;
				}
				if (this.value.join(',') === vals.join(',')) return;
				setTimeout(() => {
					this.value = vals;
				}, 200);

			},
			setYears() {
				this.years = this.generateArray(this.startYear, this.endYear);
			},
			setMonths() {
				this.months = this.generateArray(1, 12);

			},
			setDays() {
				if (this.type == 3 || this.type == 4) return;
				let totalDays = new Date(this.year, this.month, 0).getDate();
				totalDays = !totalDays || totalDays < 1 ? 1 : totalDays
				this.days = this.generateArray(1, totalDays);
			},
			setHours() {
				if (this.hoursData && this.hoursData.length > 0) {
					this.hours = this.hoursData;
				} else {
					this.hours = this.generateArray(0, 23);
				}
			},
			setMinutes() {
				if (this.minutesData && this.minutesData.length > 0) {
					this.minutes = this.minutesData
				} else {
					this.minutes = this.generateArray(0, 59);
				}
			},
			setSeconds() {
				if (this.secondsData && this.secondsData.length > 0) {
					this.seconds = this.secondsData;
				} else {
					this.seconds = this.generateArray(0, 59);
				}
			},
			show() {
				this.firstShow = true
				setTimeout(() => {
					this.isShow = true;
					// #ifndef MP || H5
					this.value = []
					this.$nextTick(() => {
						setTimeout(() => {
							this.value = [...this.value]
						}, 50)
					})
					// #endif
				}, 50);
			},
			hide() {
				this.isShow = false;
				this.$emit('cancel', {});
			},
			maskClick() {
				if (!this.maskClosable) return;
				this.hide()
			},
			change(e) {
				if (!this.firstShow) return;
				this.value = e.detail.value;
				const type = Number(this.type)
				switch (type) {
					case 0:
						this.year = this.years[this.value[0]];
						break;
					case 1:
						this.year = this.years[this.value[0]];
						this.month = this.months[this.value[1]];
						this.day = this.days[this.value[2]];
						this.hour = this.hours[this.value[3]];
						this.minute = this.minutes[this.value[4]];
						break;
					case 2:
						this.year = this.years[this.value[0]];
						this.month = this.months[this.value[1]];
						this.day = this.days[this.value[2]];
						break;
					case 3:
						this.year = this.years[this.value[0]];
						this.month = this.months[this.value[1]];
						break;
					case 4:
						this.hour = this.hours[this.value[0]];
						this.minute = this.minutes[this.value[1]];
						break;
					case 5:
						this.hour = this.hours[this.value[0]];
						this.minute = this.minutes[this.value[1]];
						this.second = this.seconds[this.value[2]];
						break;
					case 6:
						this.minute = this.minutes[this.value[0]];
						this.second = this.seconds[this.value[1]];
						break;
					case 7:
						this.year = this.years[this.value[0]];
						this.month = this.months[this.value[1]];
						this.day = this.days[this.value[2]];
						this.hour = this.hours[this.value[3]];
						this.minute = this.minutes[this.value[4]];
						this.second = this.seconds[this.value[5]];
						break;
					case 8:
						this.year = this.years[this.value[0]];
						this.month = this.months[this.value[1]];
						this.day = this.days[this.value[2]];
						this.hour = this.hours[this.value[3]];
						break;
					default:
						break;
				}
				this.isEnd = true
				this.selectResult()
			},
			selectResult() {
				let result = {};
				let year = this.year;
				let month = this.formatNum(this.month || 0);
				let day = this.formatNum(this.day || 0);
				let hour = this.formatNum(this.hour || 0);
				let minute = this.formatNum(this.minute || 0);
				let second = this.formatNum(this.second || 0);
				const type = Number(this.type)
				switch (type) {
					case 0:
						result = {
							year: year,
							result: year
						};
						break;
					case 1:
						result = {
							year: year,
							month: month,
							day: day,
							hour: hour,
							minute: minute,
							result: `${year}-${month}-${day} ${hour}:${minute}`
						};
						break;
					case 2:
						result = {
							year: year,
							month: month,
							day: day,
							result: `${year}-${month}-${day}`
						};
						break;
					case 3:
						result = {
							year: year,
							month: month,
							result: `${year}-${month}`
						};
						break;
					case 4:
						result = {
							hour: hour,
							minute: minute,
							result: `${hour}:${minute}`
						};
						break;
					case 5:
						result = {
							hour: hour,
							minute: minute,
							second: second,
							result: `${hour}:${minute}:${second}`
						};
						break;
					case 6:
						result = {
							minute: minute,
							second: second,
							result: `${minute}:${second}`
						};
						break;
					case 7:
						result = {
							year: year,
							month: month,
							day: day,
							hour: hour,
							minute: minute,
							second: second,
							result: `${year}-${month}-${day} ${hour}:${minute}:${second}`
						};
						break;
					case 8:
						result = {
							year: year,
							month: month,
							day: day,
							hour: hour,
							result: `${year}-${month}-${day} ${hour}:00`
						};
						break;
					default:
						break;
				}
				this.$emit('confirm', result);
			},
			waitFix() {
				if (this.isEnd) {
					this.selectResult()
				} else {
					setTimeout(() => {
						this.waitFix()
					}, 50)
				}
			},
			btnFix() {
				setTimeout(() => {
					this.waitFix()
					this.hide();
				}, 80);
			},
			pickerstart() {
				this.isEnd = false
			}
		}
	};
</script>

<style scoped>
	.selectedText {
		color: #1B9BFC !important;
		font-size: 36rpx !important;
	}
	
	.uni-picker-view-indicator:after, .uni-picker-view-indicator:before {
		border-top: none !important;
		border-bottom: none !important;
	}
	
	.tui-datetime-picker {
		position: relative;
	}

	.tui-datetime__picker-view {
		height: 100%;
		box-sizing: border-box;
	}

	.tui-datetime__mask {
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		background-color: rgba(0, 0, 0, 0.6);
		visibility: hidden;
		opacity: 0;
		transition: all 0.3s ease-in-out;
	}

	.tui-datetime__mask-show {
		visibility: visible !important;
		opacity: 1 !important;
	}

	.tui-datetime__header {
		width: 100%;
		transition: all 0.3s ease-in-out;
		transform: translateY(100%);
	}

	.tui-date-header {
		width: 100%;
		height: 52rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		font-size: 26rpx;
		line-height: 26rpx;
		/* #ifdef MP */
		box-shadow: 0 15rpx 10rpx -15rpx #efefef;
		/* #endif */
		/* #ifndef MP */
		box-shadow: 0 15rpx 10rpx -15rpx #888;
		/* #endif */
		position: relative;
		z-index: 2;
	}

	.tui-date-unit {
		flex: 1;
		text-align: center;
		font-size: 36rpx;
		color: #333333;
	}

	.tui-show {
		transform: translateY(0);
		opacity: 1;
	}

	.tui-picker-header {
		width: 100%;
		height: 90rpx;
		padding: 0 40rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		box-sizing: border-box;
		font-size: 32rpx;
		position: relative;
	}

	.tui-date-radius {
		border-top-left-radius: 20rpx;
		border-top-right-radius: 20rpx;
		overflow: hidden;
	}

	.tui-picker-header::after {
		content: '';
		position: absolute;
		border-bottom: 1rpx solid #eaeef1;
		-webkit-transform: scaleY(0.5);
		transform: scaleY(0.5);
		bottom: 0;
		right: 0;
		left: 0;
	}

	.tui-date__picker-body {
		width: 100%;
		/* height: 520rpx; */
		overflow: hidden;
	}

	.tui-date__column-item {
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 28rpx;
		color: #333;
	}

	.tui-font-size_32 {
		font-size: 32rpx !important;
	}

	.tui-date__unit-text {
		font-size: 24rpx !important;
		padding-left: 8rpx;
	}

	.tui-btn-picker {
		padding: 16rpx;
		box-sizing: border-box;
		text-align: center;
		text-decoration: none;
		flex-shrink: 0;
		/* #ifdef H5 */
		cursor: pointer;
		/* #endif */
	}

	.tui-opacity {
		opacity: 0.5;
	}

	.tui-pickerdate__title {
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		flex: 1;
		padding: 0 30rpx;
		box-sizing: border-box;
		text-align: center;
	}
</style>

用法跟原来的tui-datetime一样。

<tuiDatetime ref="dateTime" :type="1" :startYear="startYear" :endYear="endYear"
	color="#e41f19" :setDateTime="setDateTime" :unitTop="true" :radius="false" @confirm="change">
</tuiDatetime>

js

import tuiDatetime from "@/components/tiem_yg/tuiDatetime.vue"
const setDateTime = ref('')
const startYear = ref(1900)
const endYear = ref()
const result = ref('')
const dateTime = ref(null)
function change(e) {
	result.value = e.result;
}

更改了选中框的字体、去掉了选中框的border、删掉了取消确定按钮

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/363098.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

论文阅读-一个用于云计算中自我优化的通用工作负载预测框架,

论文标题&#xff1a;A Self-Optimized Generic Workload Prediction Framework for Cloud Computing 概述 准确地预测未来的工作负载&#xff0c;如作业到达率和用户请求率&#xff0c;对于云计算中的资源管理和弹性非常关键。然而&#xff0c;设计一个通用的工作负载预测器…

spring-boot-admin的介绍和使用

概述 Spring Boot 有一个非常好用的监控和管理的源软件&#xff0c;这个软件就是 Spring Boot Admin。该软件能够将 Actuator 中的信息进行界面化的展示&#xff0c;也可以监控所有 Spring Boot 应用的健康状况&#xff0c;提供实时警报功能。 主要的功能点有&#xff1a; 显…

springboot集成rocketmq-spring-boot-starter的坑(避坑指南)

1.说明版本&#xff08;解决方法&#xff09; springboot版本&#xff1a;2.2.2.RELEASE RocketMQ版本&#xff1a;rocketmq-spring-boot-starter 2.2.2 2.坑 rocketmq-spring-boot-starter的版本一开始&#xff0c;使用的是2.2.0版本&#xff0c;一直出现一个问题&#x…

leetcode刷题(剑指offer) 101.对称二叉树

101.对称二叉树 给你一个二叉树的根节点 root &#xff0c; 检查它是否轴对称。 示例 1&#xff1a; 输入&#xff1a;root [1,2,2,3,4,4,3] 输出&#xff1a;true示例 2&#xff1a; 输入&#xff1a;root [1,2,2,null,3,null,3] 输出&#xff1a;false提示&#xff1a; …

探究HMAC算法:消息认证与数据完整性的完美结合

Hash-based Message Authentication Code&#xff08;基于哈希的消息认证码&#xff0c;简称HMAC&#xff09;算法作为一种广泛应用的消息认证码&#xff08;MAC&#xff09;算法&#xff0c;在现代信息安全领域起着至关重要的作用。本文将从算法原理、优缺点、实际应用等方面&…

RS485自动收发电路震荡的问题

电路 设计初衷 电源5V 选择5V的原因&#xff0c;差分2.5V比1.5V可以提高传输能力 TTL输入 3.3V电平满足需求 TTL输出 4.5V了&#xff0c;MCU是3.3V平台 这样就分为两种情况 MCU接收端可以容忍5V输入 MCU接收端不可以容忍5V输入&#xff0c;就要进行电压转换&#xff0c;我这里使…

VS之调用程序对DLL中全局变量的使用

接上篇《VS生成C动态链接库DLL》&#xff0c;能够生成DLL&#xff0c;且能调用后&#xff0c;遇到一个问题&#xff0c;即在DLL程序中定义了一些全局变量&#xff0c;应用程序需要使用&#xff0c;本以为可以直接使用&#xff0c;没想到&#xff0c;还是需要设置才可以&#xf…

Zookeeper服务注册与发现实战

目录 设计思路 Zookeeper注册中心的优缺点 SpringCloudZookeeper实现微服务注册中心 第一步&#xff1a;在父pom文件中指定Spring Cloud版本 第二步&#xff1a;微服务pom文件中引入Spring Cloud Zookeeper注册中心依赖 第三步&#xff1a; 微服务配置文件application.y…

猫什么时候发腮?全猫适用发腮长肉的生骨肉冻干分享

猫什么时候发腮是猫父母们非常关心的问题。在猫咪的成长过程中&#xff0c;发腮是一项重要的体征&#xff0c;也是猫咪成熟的标志。想要让猫咪拥有可爱的肉嘟嘟脸型&#xff0c;主人需要在适龄的年龄段加强营养补给&#xff0c;不要错失最佳发腮期。那么&#xff0c;猫咪的最佳…

前端性能优化:Vue项目打包后app.xxx.js 和 chunk-vendors.xxx.js 文件太大,导致页面加载时间太长

问题场景&#xff0c;如下图&#xff0c;环境上的 app.js 和chunk-vendors.js 两个文件大小&#xff0c;高达3.4M 和 2M &#xff0c;加载所耗费的时间也很长。 下面说一下如何解决&#xff1a; 1、首先需要安装插件 compression-webpack-plugin&#xff0c;我这里用的是6.1.1…

牛客——丢手绢(尺取法)

链接&#xff1a;登录—专业IT笔试面试备考平台_牛客网 来源&#xff1a;牛客网 题目描述 “丢~丢~丢手绢&#xff0c;轻轻地放在小朋友的后面&#xff0c;大家不要告诉她&#xff0c;快点快点抓住她&#xff0c;快点快点抓住她。” 牛客幼儿园的小朋友们围成了一个圆圈准…

02.PostgreSQL运算符

1. 算术运算符 算术运算符 描述 示例 + 加法运算符 SELECT A+B - 减法运算符 SELECT A-B * 乘法运算符 SELECT A*B / 除法运算符 SELECT A/B % 取余运算符 SELECT A%B 1.1 加法与减法操作符 SELECT 100,100+11,100-11,100+23.0,100-23.0 运算结果 由此得出结论: 一个整数加上…

Go语言基础之接口

接口类型 一个接口类型就是一组方法的集合&#xff0c;它规定了需要实现的所有方法。 接口的定义 每个接口类型由任意个方法签名组成&#xff0c;接口的定义格式如下&#xff1a; type 接口类型名 interface{方法名1( 参数列表1 ) 返回值列表1方法名2( 参数列表2 ) 返回值列…

强化学习原理python篇08——actor-critic

强化学习原理python篇08——actor-critic 前置知识TD ErrorREINFORCEQACAdvantage actor-critic (A2C) torch实现步骤第一步第二步第三步训练结果 Ref 本章全篇参考赵世钰老师的教材 Mathmatical-Foundation-of-Reinforcement-Learning Actor-Critic Methods 章节&#xff0c;请…

C#小结:ScottPlot 5.0在VS2022桌面开发的应用(以winform为例)

目录 一、官网文档地址 二、在VS2022中安装Scottplot 三、拖动Scottplot 四、使用Scottplot 五、效果图 一、官网文档地址 官网地址&#xff1a;ScottPlot 5.0 食谱 本文内容来自于官网&#xff0c;选取了官网的一些比较好用的功能展示&#xff0c;如需学习更多功能&a…

个人建站前端篇(二)项目采用服务端渲染SSR

SSR的优点 更好的SEO首屏加载速度更快&#xff0c;用户体验更好可以使用相同的语言以及相同的声明式、面向组件的心智模型来开发整个应用&#xff0c;而不需要在后端模板系统和前端框架之间来回切换。 Vue生态中的SSR通用解决方案 Nuxt是一个构建于 Vue 生态系统之上的全栈框…

虚拟机扩容后黑屏卡死解决方法

亲测有效&#xff0c;首先一般是在扩容后黑屏的&#xff0c;现象为开机后看到个横线光标不闪&#xff0c;黑屏&#xff0c;进入不了桌面。原因是硬盘已经满了&#xff0c;所以解决方法就是清理硬盘。所以首先还是要解决登录问题。 开机时按 esc 键进入 GNU GRUB&#xff0c;选择…

C#网络爬虫之TianyaCrawler实战经验分享

互联网时代的到来带来了大量的数据&#xff0c;而网络爬虫技术成为了获取这些数据的重要途径之一。如果你是一名C#开发者&#xff0c;那么你可能会对TianyaCrawler这个强大的网络爬虫框架感兴趣。本文将带你深入了解TianyaCrawler&#xff0c;分享它的技术概况、使用场景&#…

PHP集成开发环境 PhpStorm 2023 for mac中文激活版

PhpStorm 2023 for Mac是一款功能强大的PHP集成开发环境&#xff08;IDE&#xff09;&#xff0c;旨在帮助开发者更高效地编写、调试和测试PHP代码。该软件针对Mac用户设计&#xff0c;提供了丰富的功能和工具&#xff0c;以简化开发过程并提高开发效率。 软件下载&#xff1a;…

如何用MapTalks IDE来发布网站?

简介 MapTalks IDE 全称 MapTalks集成设计环境&#xff08;Integrated Design Environment&#xff09;&#xff0c;是由MapTalks技术团队开发的新一代web地图设计软件。 通过MapTalks IDE&#xff0c;您可以自由的创建二维和三维地图&#xff0c;在其中载入或创建地理数据&a…
最新文章