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 >
        <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

Vue入门之HelloWorld

声明式渲染

F12操作控制台, 控制台输入vm.name="Vue"观察页面变化。

Vue入门之HelloWorld

相关文章:

  • 2022-02-19
  • 2022-12-23
  • 2021-05-20
  • 2021-04-19
  • 2021-11-09
  • 2022-12-23
  • 2021-09-19
  • 2021-09-19
猜你喜欢
  • 2021-08-25
  • 2021-08-06
  • 2021-12-03
  • 2021-12-21
  • 2021-08-04
  • 2021-08-15
  • 2021-12-07
相关资源
相似解决方案