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
|
const app = Vue.createApp({
methods:{
changeCardValue(){
this.$refs.card.title = "新的卡片標題";
this.$refs.card.content = "新的卡片內容文字";
this.$refs.card.footer = "新的卡片底部文字"
}
}
})
app.component('card-component',{
data(){
return{
title: "卡片標題",
content: "卡片內容",
footer: "卡片底部"
}
},
template:`
<div class="card">
<div class="card-header">
{{ title }}
</div>
<div class="card-body">
{{ content }}
</div>
<div class="card-header">
{{ footer }}
</div>
</div>
`
})
app.mount("#app");
|