美文网首页
vue实现数据的显示和隐藏

vue实现数据的显示和隐藏

作者: Kemmy_m | 来源:发表于2020-04-03 10:34 被阅读0次

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <title>head</title>

</head>

<script src="vue.min.js"></script>

<body>

<div id="app">

    <button @click="toggle">显示和隐藏数据</button><br>

    <span v-show="isshow">hello</span>

</div>

</body>

<script>

    new Vue({

        el:'#app',

        data:{

            return {

                    isshow:false

                };

        },

        methods:

        {

            toggle:function () {

                this.isshow=!this.isshow;//对它进行取反

            }

        }

    });

</script>

</html>

相关文章

网友评论

      本文标题:vue实现数据的显示和隐藏

      本文链接:https://www.haomeiwen.com/subject/uaocphtx.html