Vue入門之HelloWorld


初始化項目

npm init -y

安裝Vue

npm install vue

HelloWorld

創建index.html

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <div id="app">
        <h1>Hello,{{name}}!</h1>
    </div>

    <script src="./node_modules/vue/dist/vue.js"></script>
    <script>
        let vm = new Vue({
            el: "#app",
            data: {
                name: "World"
            }
        })
    </script>
</body>

</html>

運行html

hello-world

聲明式渲染

F12操作控制台, 控制台輸入vm.name="Vue"觀察頁面變化。

show


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM