1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <title>Vue3快速入门</title>
- <style>
- #app div {
- display: none
- }
- </style>
- </head>
- <body>
- <div id="app">
- <div :style="{'display':'block'}">
- {{text}}
- </div>
- </div>
- <script src="https://cdn.staticfile.org/vue/3.0.5/vue.global.js"></script>
- <script>
- const {ref, createApp ,onMounted} = Vue
- const app = {
- setup() {
- const text = ref(0);
- function aa(){
- text.value=text.value+1
- }
- onMounted(() => {
- aa()
- });
-
- return {
- text,
- }
- }
- }
- createApp(app).mount('#app')
- </script>
- </body>
- </html>
|