SOURCE

console 命令行工具 X clear

                    
>
console
let app = new Vue({
     el: '#app',
     data() {
         return {
             time: 90 * 60,
             goal: {
                 korea: 0,
                 cn: 0
             },
             timeContrl: null
         }
     },
     computed: {
         broadcast: function() {
             if(this.goal.korea == this.goal.cn)
                return "双方比赛很焦灼";
             else if(this.goal.korea > this.goal.cn)
                return "韩国队领先";
             else if(this.goal.korea < this.goal.cn) 
                return "中国队领先";
             else 
                return "直播信号中断了"
         }
     },
     methods: {
         goaled: function(key) {
             this.goal[key]++;
         }
     },
     created: function() {
         this.timeContrl = setInterval(() => {
             this.time--;
             if(this.time == 0)
                clearInterval(this.timeContrl);
         }, 1000)
     },
});
<div id="app">
    <p>事件: {{time}}</p>
    <p>{{broadcast}}</p>
    <p>韩国队:{{goal.korea}}<button @click="goaled('korea')">进球</button></p>
    <p>中国队:{{goal.cn}}<button @click="goaled('cn')">进球</button><p>
</div>

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