vue3.0学习

  1. 引入vue js文件
    可以从官网编译,也可以直接简单从这个网站下载下来
    https://unpkg.com/vue@3.0.0-beta.17/dist/vue.global.js
  2. 新建index.html
<!DOCTYPE html>
<html xml:lang>
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script src="vue.global.js"></script>
    </head>
    <body>
        <div id="app">
            {{message}}
        </div>
    </body>
    <script>
        //1 引入createApp函数
        const {createApp} = Vue
        const message = "hello ,lxj"
        // 定义app
        const app ={
            setup(){
                return {
                    message
                }
            }
        }
        //2 调用app,将我们的app传递进去,并绑定app节点
        createApp(app).mount('#app')
    </script>

    <style>
    </style>
</html>

vue基础

  • vue指令
<!DOCTYPE html>
<html xml:lang>
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script src="vue.global.js"></script>
    </head>
    <body>
        <div id="app">
            //v-text 其实就是等于html中加入了 innertext
            <div v-text="message"></div>
        </div>
    </body>
    <script>
        //1 引入createApp函数
        const {createApp} = Vue
        const message = 'hello ,lxj'
        // 定义app
        const app ={
            setup(){
                return {
                    message
                }
            }
        }
        //2 调用app,将我们的app对象传递进去,并绑定app节点
        createApp(app).mount('#app')
    </script>

    <style>
    </style>
</html>
# vue 

评论

渣男 : 456
三群的弟弟 : 123
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×