guopengfa
发布于 2020-05-25 / 541 阅读 / 0 评论 / 0 点赞

hello,VUE

<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Table_view</title>
</head>
    <body>
        <div id="app">
            <h1>当前计数:{{counter}}</h1>
            <button v-on:click = "add">+</button>
            <button v-on:click = "sub">-</button>
        </div>
    <script src = "vue.js"></script>
    <script>
        const app = new Vue({
            el:"#app",
            data:{
                counter:9
            },
            methods:{
                add:function(){
                    this.counter++;
                },
                sub:function(){
                    this.counter--;
                }
            },
        })
    </script>
</body>
</html>
Table_view

当前计数:{{counter}}


评论