开始学习组件

main
RogerWork 1 year ago
parent 3b0e605625
commit 1d0ed3e3cd
  1. 27
      demo/component-1.html

@ -0,0 +1,27 @@
<!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=edfe">
<script src="https://unpkg.com/vue@3.3.4/dist/vue.global.js"></script>
<title>Vue-Component</title>
</head>
<body>
<div id="app">
<button-component></button-component>
</div>
<script type="text/javascript">
const app = Vue.createApp({})
app.component('button-component', {
data() {
return {
count: 0
}
},
template: '<button v-on:click="count++">点击了{{count}}次</button>'
})
app.mount("#app")
</script>
</body>
</html>
Loading…
Cancel
Save