vue實(shí)現(xiàn)記事本功能
更新時(shí)間:2021年06月24日 14:58:12 作者:zy6648
這篇文章主要為大家詳細(xì)介紹了vue實(shí)現(xiàn)記事本功能,記事本可以進(jìn)行添加刪除事件,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
本文實(shí)例為大家分享了vue實(shí)現(xiàn)記事本功能的具體代碼,供大家參考,具體內(nèi)容如下
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>記事本</title> <meta http-equiv="X-UA-Compatible" content="IE-edge"> <meta name="viewport" content="width=device-width,initial-scale=1"> <link rel="stylesheet" type="text/css" href="./bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="external nofollow" > <script type="text/javascript" src="./vue.js"></script> </head> <body> <div class="container" id="app"> <div class="row"> <div class="col-md-6 "> <h1 class="text-succeed">{{title}}</h1> <input type="text" name="text" placeholder="填寫(xiě)事務(wù)" v-model="newThing"/> <button type="button" class="btn text-active" v-on:click="addThing" v-on:keyup.enter="addThing">添加事務(wù)</button> </div> </div> <div class="row"> <div class="col-md-3 "> <div class="thumbnail"> <ul> <li v-for="(item,index) in things" class="text-center text-info" v-show="item.show">{{item.thing}} <button class="btn btn-default bg-info" v-on:click="removeThing(index)" v-model="index">刪除</button></li> </ul> </div> </div> </div> </div> </body> <script type="text/javascript"> var vue=new Vue({ el:'#app', data:{ title: '記事本', things:[ { thing:'', show:false } ], newThing:'', message:'待填寫(xiě)的事務(wù)為空??!' }, methods:{ addThing:function(){ if(this.newThing){ this.things.splice(0,0,{ thing:this.newThing, show:true }); this.newThing='' }else{ alert(this.message) } }, removeThing:function(index){ this.things[index].show=false } } }); </script> </html>
效果圖:
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
您可能感興趣的文章:
- 詳解探索 vuex 2.0 以及使用 vuejs 2.0 + vuex 2.0 構(gòu)建記事本應(yīng)用
- 基于vue2.0+vuex+localStorage開(kāi)發(fā)的本地記事本示例
- vue實(shí)現(xiàn)記事本案例
- Vue實(shí)現(xiàn)簡(jiǎn)易記事本
- Vue實(shí)現(xiàn)簡(jiǎn)易記事本功能
- vue實(shí)現(xiàn)記事本小功能
- vue簡(jiǎn)易記事本開(kāi)發(fā)詳解
- Vue記事本實(shí)例詳解
- vue-cli+webpack記事本項(xiàng)目創(chuàng)建
- Vuex實(shí)現(xiàn)記事本功能
相關(guān)文章
基于vue-cli創(chuàng)建的項(xiàng)目的目錄結(jié)構(gòu)及說(shuō)明介紹
下面小編就為大家分享一篇基于vue-cli創(chuàng)建的項(xiàng)目的目錄結(jié)構(gòu)及說(shuō)明介紹,具有很好的參考價(jià)值,希望對(duì)大家有所幫助2017-11-11Vue項(xiàng)目打包、合并及壓縮優(yōu)化網(wǎng)頁(yè)響應(yīng)速度
網(wǎng)站頁(yè)面的響應(yīng)速度與用戶(hù)體驗(yàn)息息相關(guān),直接影響到用戶(hù)是否愿意繼續(xù)訪(fǎng)問(wèn)你的網(wǎng)站,所以這篇文章主要給大家介紹了關(guān)于Vue項(xiàng)目打包、合并及壓縮優(yōu)化網(wǎng)頁(yè)響應(yīng)速度的相關(guān)資料,需要的朋友可以參考下2021-07-07VUE 文字轉(zhuǎn)語(yǔ)音播放的實(shí)現(xiàn)示例
本文主要介紹了VUE 文字轉(zhuǎn)語(yǔ)音播放的實(shí)現(xiàn)示例,文中通過(guò)示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2022-02-02Vue3中無(wú)法為el-tree-select設(shè)置反選問(wèn)題解析
這篇文章主要介紹了Vue3中無(wú)法為el-tree-select設(shè)置反選問(wèn)題分析,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2023-04-04