Vue的学习(1)

160 阅读1分钟

1.初始化项目npm init -y,设置Vue,将vue加入到项目中npm install vue
2.在中导入script

<script type="text/javascript" src="./node_modules/vue/dist/vue.js"></script>

3.实际案例

<!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">
    <title>Document</title>
    <script type="text/javascript" src="./node_modules/vue/dist/vue.js"></script>
</head>
<body>
    <div id="app">
        <h1>{{name}},wonderful!</h1>
    </div>

    

    <script>
        let vm=new Vue({
            el: "#app",
            data:{
                name: "rider"
            }
        });

    </script>


</body>
</html>