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>
原文地址:https://www.cnblogs.com/SunShineM/p/7597629.html