1. Use EL as our mount point

<! DOCTYPEhtml>
<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>
    <div id="app">
        <p>Name: {{person. Name}}</p>
        <p>Age: {{person. Age}}</p>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
    <script>
        new Vue({
            el: '#app'.data: {
                person: {
                    name: 'rayn'.age: '18'}}})</script>
</body>
</html>
Copy the code

2. Render with the render function

<! DOCTYPEhtml>
<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>
    <div id="app">

    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
    <script>
        new Vue({
            data: {
                person: {
                    name: 'rayn'.age: '18'}},render(h) {
                return h('div', [
                    h('p'.'name' + this.person.name),
                    h('p'.'年龄 ' + this.person.age)
                ])
            }
        }).$mount('#app')
    </script>
</body>

</html>
Copy the code