学习日记--简单的vue函数操作演示

<div id="app-5">
    <button v-on:click="func1">点击按钮</button>
    <b>{{seenmsg}}</b>
    <p v-if="seen">11111111111111111</p>
</div>
<script type="text/javascript">
var app5 = new Vue({
  el: '#app-5',
  data: {
    seen: true,
    seenmsg: ''
  },
  methods: {
    func1: function () {
        this.seen=!this.seen;
        if(this.seen==true){this.seenmsg='段落已被显示';}
        if(this.seen==false){this.seenmsg='段落已被隐藏';}
    }
  }
})
</script>
posted @ 2022-12-06 22:21  轻风细雨_林木木  阅读(4)  评论(0编辑  收藏  举报