1. <div id="app">
  2. <ul>
  3. <li v-for="item in lists">{{ item }}</li>
  4. </ul>
  5. </div>

Vue2

  1. const app = new Vue({
  2. el: '#app',
  3. data() {
  4. return {
  5. lists: ['西安', '北京', '上海', '深圳'],
  6. }
  7. },
  8. })

Vue3

  1. const App = {
  2. data() {
  3. return {
  4. lists: ['西安', '北京', '上海', '深圳'],
  5. }
  6. },
  7. }
  8. Vue.createApp(App).mount('#app')