Skip to content

Instantly share code, notes, and snippets.

@rosd89
Last active August 22, 2017 12:11
Show Gist options
  • Save rosd89/e0799ae7e1ba5d954420c35321d10276 to your computer and use it in GitHub Desktop.
Save rosd89/e0799ae7e1ba5d954420c35321d10276 to your computer and use it in GitHub Desktop.
Vue·tiful Korea 170823 컴포넌트야 놀자
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>todo</title>
</head>
<body>
<div id="root"></div>
</body>
<script src="https://unpkg.com/vue"></script>
<script type="application/javascript">
Vue.component('todo-content', {
template: `
<div class="todo-content">
<h1>Todo List</h1>
<slot></slot>
</div>`
});
Vue.component('todo-list', {
data() {
return {
items: ['A', 'B', 'C']
}
},
template: `<ul><todo-item v-for="item in items" :name="item"></todo-item></ul>`
});
Vue.component('todo-item', {
props: ['name'],
template: `<li>{{name}}</li>`
});
new Vue({
el: '#root',
template: `
<todo-content>
<todo-list></todo-list>
</todo-content>`,
});
</script>
<style>
.todo-content {
width: 720px;
background: #dddddd;
margin: 0 auto;
padding: 1px 5px 10px 5px;
}
</style>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment