31 lines
776 B
HTML
31 lines
776 B
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
|
|
<title>hello world</title>
|
|
</head>
|
|
<body>
|
|
<div id="root"></div>
|
|
</body>
|
|
<script>
|
|
Vue.createApp({
|
|
data() {
|
|
return {
|
|
show:true
|
|
}
|
|
},
|
|
methods: {
|
|
handleBtnClick(){
|
|
this.show=!this.show;
|
|
}
|
|
},
|
|
template:`<div>
|
|
<span v-if="show">hello</span>
|
|
</div>
|
|
<Button v-on:click="handleBtnClick">按钮</Button>`
|
|
}).mount("#root");
|
|
</script>
|
|
</html> |