<div id="app">
<ul>
<li v-for="item in lists">{{ item }}</li>
</ul>
</div>
Vue2
const app = new Vue({
el: '#app',
data() {
return {
lists: ['西安', '北京', '上海', '深圳'],
}
},
})
Vue3
const App = {
data() {
return {
lists: ['西安', '北京', '上海', '深圳'],
}
},
}
Vue.createApp(App).mount('#app')