SOURCE

console 命令行工具 X clear

                    
>
console
new Vue({
    el: '#app',
    data: {
        num: 0,
        colour: ""
    },
    methods: {
        subFn() {
            if (this.num == 0) return
            this.num = this.num - 1
        },
        addFn() {
            this.num = this.num + 1
        },
        redFn() {
            this.colour = "red"
        }
    }
})
<div id="app">
  <div>
    <button @click="subFn()">减少</button>
    <p :class="colour">当前计数:{{this.num}}</p>
    <button @click="addFn()">增加</button>
    <button @click="redFn()">计数变红色</button>
  </div>   
</div>
.red{
    color: red;
}

本项目引用的自定义外部资源