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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <!-- 需求/目的:  把数据渲染到页面中 -->
    <!-- 1. 提供容器 -->
    <div >
        <!-- 5. 在视图中使用data的数据   -->
        <p>{{str}}</p>
    </div>
    <!-- 2. 引入 -->
    <script src="./vue.js"></script>
    <script>
        // 模拟ajax返回的数据
        var str = "abc";
        // 3. 实例化Vue对象
        var vm = new Vue({
            // 4. 设置Vue的选项
            el: "#app",
            data: {
                str: str
            }
        });
    </script>

</body>

</html>
 

相关文章:

  • 2022-02-06
  • 2022-12-23
  • 2022-12-23
  • 2021-04-20
  • 2021-12-19
  • 2021-11-24
  • 2021-08-08
猜你喜欢
  • 2021-12-06
  • 2021-12-23
  • 2021-04-18
  • 2021-07-16
  • 2021-07-11
  • 2021-11-01
  • 2021-10-14
相关资源
相似解决方案