=> main.js
1.import Users from './components/Users'
2.//全局注册组件 Vue.component("users",Users);
3.Users.vue
<template>
<div class="users">
<ul>
<li v-for="user in users">
{{user}}
</li>
</ul>
</div>
</template>
<script>
export default {
name: 'users',
data(){
return {
users:["Herry","Bucky","Emily"]
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>
网友评论