Vue 记事本界面

本地应用-记事本

1. 前端编译器 Hbuilder X

代码如下(示例):

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <script>
      var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
        CSS.supports('top: constant(a)'))
      document.write(
        '<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
        (coverSupport ? ', viewport-fit=cover' : '') + '" />')
    </script>
    <title></title>
    <!--preload-links-->
    <!--app-context-->
	<script src="vue.js" type="text/javascript" charset="UTF-8"></script>	
  </head>
  
  //html
  <body>
	  <section id='todoapp' >
		  <header class='head'>
			<input style="position: relative;width: 90%;height: 25px;margin: 25px;" 
			autofocus='focus' autocomplete="off" placeholder="请输入内容" v-model="inputString">
		  </header>
		  <!-- 列表区域 -->
		  <section class='main' style='position: relative' >
			  <fieldset class='todo-li' >
				  <legend>计算机网络的发展历史</legend>
				  <li class='todo' style="list-style-type: none;" v-for="(item,index) in list">
					  <div class='view'> <!--div包裹了以下-->
						  <span class='index'>{{index+1}}.{{''}}</span>
						  <label>{{item}}</label>						  						  
					  </div>					  
				  </li>				  
			  </fieldset>
			  <button class='add-btn' v-on:click="added()">添加</button>
			  <button class='del-btn' @click="deleted(index)">删除</button>
			  <button class='complete-clr' @click="cleared()">清除</button>
		  </section>
		  <section class='foot' v-for="list.length!=0">
			总共<span class='todo-count'><strong>{{list.length}}</strong></span>	个列表项		
		  </section>
	  </section>
	
	//js  
	<script>		
		var app=new Vue({
			el:'#todoapp',
			data:{
				list:['第一代计算机主机面向无终端的网络',
				'第二代以通信子网和资源子网为中心',
				'第三代以Internet为中心的新一代网络'],
				inputString:''
			},
			methods:{
				added:function(){
					// this.list+=this.inputString 数组怎么增加元素
					this.list.push(this.inputString)
				},
				deleted:function(index){
					this.list.splice(index,1)
				},
				cleared:function(){
					this.list=[]
				},
			}			
		})		
	</script>
	
	//css
	<style>
		#todoapp{
			width: 80%;
			min-height: 250px;
			border: 1px solid black;
			font-family: 'Lucida Console', monospace;
			font-size: 14px;
			line-height: 1.5;
			padding: 5px;
			border: 2px solid #ccc;
			border-radius: 5px;
			box-shadow: 0 0 5px #ccc;
			background-color: #f1f1f1;
			color: #000;
		}		
		.todo-li{
			background-color: lightblue;
			color: black;
			border: 2px solid black;
			border-radius: 10px;
			padding: 10px 20px;
			font-size: 16px;
			text-align: left;
			/* list-style-image: url(./static/logo.png); */
		}
		.add-btn,.del-btn,.complete-clr{
			  background-color: red;
			  color: white;
			  border: 2px solid black;
			  border-radius: 10px;
			  padding: 5px 10px;
			  margin: 10px;
			  font-size: 16px;
			}
		.add-btn{
			  position:absolute;
			  right: 140px;
			}
		.del-btn{
			 position:absolute;
			  right: 70px;
			}
		.complete-clr{
			background-color: rosybrown;
			position:absolute;
			right: 0px;
			}
		}		
	</style>
		
  </body>
</html>

2.初始界面预览

在这里插入图片描述

3.添加 删除 清除

在这里插入图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值