元素显示v-show

<!DOCTYPE html>
<html lang="zh">

<head>
    <title></title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="https://unpkg.com/vue/dist/vue.js"></script>
    <link href="../css/style.css" rel="stylesheet"> </head>

<body>
<div id="myApp">
    <h1 v-show="result">任天堂新一代主机Switch</h1>
    <button @click="btnClick">显示按钮</button>
</div>
<script>
    var myApp = new Vue({
        el: '#myApp', 
        data: {
            result: true
        },
        methods: {
            btnClick: function(){
                this.result = !this.result;
            },
        },
    });
</script>
</body>

</html>

 

上一篇:条件渲染v-if


下一篇:Ingress使用示例