1. <div id="app">
  2. <h1 v-text="name"></h1>
  3. </div>

Vue2

  1. const app = new Vue({
  2. el: '#app',
  3. data() {
  4. return {
  5. name: '沐颖汐',
  6. }
  7. },
  8. })

Vue3

  1. const App = {
  2. data() {
  3. return {
  4. name: '沐颖汐',
  5. }
  6. },
  7. }
  8. Vue.createApp(App).mount('#app')