实例化Vue时的两种挂载方式el与$mount

1.el

new Vue({
  el: '#app',
  data: obj
})
<div id="app">
  <p>{{ foo }}</p>
  <!-- 这里的 `foo` 不会更新! -->
  <button v-on:click="foo = 'baz'">Change it</button>
</div>

2.$mount

const app = new Vue({
    router,
    i18n,
    ...App
}).$mount('#app')
<div id="app">
    <h1 style="font-size: 16px; text-align: center;">{{ $t("message.hello") }}</h1>
</div>
原文地址:https://www.cnblogs.com/ajaemp/p/11811720.html