SOURCE

console 命令行工具 X clear

                    
>
console
new Vue({
  el:'#app',
  data:{
    btn: '开始',
    goods:['小米5x','荣耀6p','魅族5','iphone9','外星人笔记本','谢谢惠顾'],
    good: ''
  },
  methods:{
    timer:function() {},
    start:function() {
      this.btn = this.btn == '开始' ? '停止' : '开始';
    },
    set:function() {
      var m = parseInt(Math.random() * this.goods.length);
    	this.good = this.goods[m]
    }
  },
  watch: {
    btn:function() {
      if(this.btn == '停止') {
      	this.timer = setInterval(this.set,50);
      }else {
        clearInterval(this.timer);
      }
    }
  }
})
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
<div id='app'>
  <h1>点击开始抽奖</h1>
  <ul>
    <li v-for='good in goods'>{{ good }}</li>
  </ul>
  <hr>
  <center><button @click='start'>{{ btn }}</button></center>
  <p>{{ good }}</p>
</div>
:root{
  background:white;
}
h1 {
  text-align:center
}
ul li {
  list-style:none;
}