12345678910111213141516171819202122232425262728293031323334353637383940 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>模板</title>
- <!-- 引入文件 -->
- <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
- <style>
- .active {
- height: 200px;
- width: 200px;
- border: 1px solid red;
- }
- </style>
- </head>
- <body>
- <div id="app">
- </div>
- </body>
- <script>
- const { createApp, ref ,onMounted ,onBeforeMount } = Vue;
- createApp({
- setup() {
- onBeforeMount( () =>{
- console.log(`the component is now onBeforeMount.`)
- })
- onMounted( () => {
- console.log(`the component is now mounted.`)
- //加载数据列表
- })
- }
- }).mount('#app'); //createApp创建对象 挂在到app
- </script>
- </html>
|