vue實現點擊按鈕,內容部分顯示隱藏


<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <script src = "https://unpkg.com/vue/dist/vue.js" ></script>
  <title>Document</title>
</head>
<body>
  <div id="wrap">
    <p v-if="seen">出來了</p>
    <button type="button" name="button" @click="change">{{message}}</button>
  </div>
  <script type="text/javascript">
  var app = new Vue({ el:'#wrap', data:{ seen:true, message:'隱藏' }, methods:{ change:function(){ this.seen = !this.seen if (this.seen) { this.message = '隱藏' }else{ this.message = '顯示' } } } }) // var date = new Date(); // console.log(date);//Tue Sep 26 2017 14:34:27 GMT+0800 (CST) // console.log(new Date().toLocaleString());//2017/9/26 下午2:34:27 // var d = new Date().getTime(); // console.log(d);//1506408973192 // console.log(new Date(d).toLocaleString());//2017/9/26 下午2:56
  </script>
</body>
</html>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM