HMVue2.2【vue&浏览器调试工具的基本使用】

1

 

 

<!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>
</head>
<body>

    <!-- 希望 Vue 能够控制下面的这个 div,帮我们在把数据填充到 div 内部 -->
    <div id="app">{{ username }}</div>

    <!-- 1. 导入 Vue 的库文件,在 window 全局就有了 Vue 这个构造函数 -->
    <script src="./lib/vue-2.6.12.js"></script>

    <!-- 2. 创建 Vue 的实例对象 -->
    <script>
        // 创建 Vue 的实例对象
        const vm = new Vue({
            // el 属性是固定的写法,表示当前 vm 实例要控制页面上的哪个区域,接收的值是一个选择器
            el: '#app',
            // data 对象就是要渲染到页面上的数据
            data: {
                username: 'zhangsan'
            }
        })
    </script>

</body>
</html>

 

2

 

 

 

 

 

 

 

 

 

 

 

posted @ 2021-11-17 11:29  yub4by  阅读(46)  评论(0)    收藏  举报