SOURCE

console 命令行工具 X clear

                    
>
console
var Main = {
  data() {
    return {
      settings: {
        type: 'line'
      },
      num: 0
    }
  },
  computed: {
    otherSettings() {
      return {
        formatedNum: `${this.settings.type}_${this.num}px`,
        color: 'red'
      }
    }
  },
  watch: {
    otherSettings(val) {
      console.log('otherSettingsChange')
      // this.settings = Object.assign({}, this.settings, val)
      this.$set(this.settings, 'formatedNum', val.formatedNum)
    }
  },
  methods: {
    handleClick() {
      this.num += 1
    }
  }
}
var Ctor = Vue.extend(Main)
new Ctor().$mount('#app')
<script src="//unpkg.com/vue/dist/vue.js"></script>
<script src="//unpkg.com/element-ui@1.4.5/lib/index.js"></script>
<div id="app">
<template>
  <div>{{num}}</div>
  <button @click="handleClick">点我+1</button>
</template>
</div>

@import url("//unpkg.com/element-ui@1.4.5/lib/theme-default/index.css");