-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdemo-dawin.html
48 lines (46 loc) · 1.38 KB
/
demo-dawin.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Demo DAWIN</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
<movieitem v-for="m of movies" v-bind:details="m" v-on:buttonclicked="clicked"></movieitem>
</div>
<script>
Vue.component('movieitem', {
template: '<div>{{ details.title }} - {{ details.director }} <button v-on:click="onclick">edit</button> <button v-on:click="onclick">delete</button></div>',
props: [ "details" ],
data() {
return {
message: "test"
}
},
methods: {
onclick() {
console.log("clicked", this.details.title)
this.$emit("buttonclicked", this.details.title)
}
}
})
const vm = new Vue({
el: "#app",
mounted: function() {
console.log("mounted")
},
data: {
movies: [ { title: "Titanic", director: "James Cameron" }, { title: "La ligne verte", director: "Frank Darabont" } ]
},
methods: {
clicked(param) {
console.log("clicked", param)
}
}
})
</script>
</body>
</html>