2021-08-25

VUE一个丑丑的记事本

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>=-=</title>
		<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
	</head>
	<body>
		<style>
			*{
				padding: 0px;
				margin: 0px;
			}
			p{
				color: white;
				font-size: 20px;
			}
			#div{
				position: relative;
				top: 50%;
				left: 40%;
				width: 400px;
				height: 700px;
				background-size: 400px;
			}
			#imgbackground{
				position: absolute;
				left: 40%;
				width: 400px;
				height: 700px;
			}
			#div header{
				height:80px;
				text-align: center;
			}
			#div footer{
				width:400px;
				position: absolute;
				top: 650px;
				height:20px;
				text-align: center;
			}
			#div h1{
				color: white;
			}
			#div input,li{
				border: 1px;
				border-style: solid;
				border-color: gainsboro;
				width: 300px;
				height: 40px;
				left: 10%;
				text-align: center;
				position: relative;
				background-color: white;
			}
			#div ol{
				
			}
			#p{
				color: black;
				font-size: 30px;
				position: relative;
			}
			#button{
				background-image: url(img/删除.png);
				background-size: 18px;
				width: 20px;
				height: 20px;
				border: none;
				cursor: pointer;
				position: absolute;
				top:10px ;
				left: 270px;
			}
			#chooseImg{
				background-color: aliceblue;
				position: absolute;
				left: 67%;
				top: 20%;
				width: 400px;
				height: 500px;
			}
			.littleImg{
				width: 100px;
				height: 150px;
			}
			#chooseImg ul li{
				width: 100px;
				height: 150px;
				margin: 20px;
				float:left;
			}
			#
		</style>
		<img id="imgbackground" :src="src" />
		<div id="div">
			<header id="header">
				<h1>记事本</h1>
			</header>
			<section id="section">
				<input type="text" id="input" value="请输入" v-model="message" @keyup.enter="addMessage(message)" />
				<ol>
				<li class="li" v-for="(event,index) in events" v-if="isTrue" >
					<p id="p">{{event}}</p>
					<button  id="button" @click="delLi(index)" ></button>
				</li>
				</ol>
			</section>
			<footer id="footer">
				<p id="p2">{{events.length}}</p>
			</footer>
			</div>
			<div id="chooseImg">
				<a href="javascript:void(0)" @click="pageSub()"><img src="img/prev.png"></a>
				<a href="javascript:void(0)" @click="pageAdd()"><img src="img/next.png"></a>
				
				<ul id="page1">
					<li class="imgli" v-for="(img,index) in imgs[imgindex]" >
						<img class="littleImg" :src="img" @click="imgChange(img)" /></li>
				</ul>
			</div>
			<script>
				
			</script>
		<script>
			var vue1 = new Vue({
				el:"#div",
				data:{
					events:['你好!'],
					message:"请输入",
					isTrue: true,
					isDel:false,
					button:"button",
				},
				methods:{
					addMessage(message){
						this.events.push(this.message);
					},
					delLi(index){
						this.events.splice(index,1)
					},
					delAppear(){
						this.isDel = !this.isDel
					},
				},
				})
			var vue2 = new Vue({
				el:"#chooseImg",
				data:{
					imgs:[["img/1.jpg","img/2.jpg","img/3.jpg","img/4.jpg"],["img/5.jpg","img/6.jpg"]],
					imgindex:0,
				},
				methods:{
					pageSub(){
						if(this.imgindex>0)
						this.imgindex--
					},
					pageAdd(){
						if(this.imgindex<1)
						this.imgindex++
					},
					imgChange(img){
						vue3.src=img
					}
				}
			})
			var vue3 = new Vue({
				el:"#imgbackground",
				data:{
					src:"img/1.jpg",
				}
			})
		</script>
	</body>
</html>

土土的记事本

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值