vue.js not work as expected

时间:2018-04-20 01:03:36

标签: javascript vue.js

I'm trying to use vue.js in the following example, but the result in browser is "product" instead of "Boots".

<div id="app">
    <h2>{{product}}</h2>
</div>
<script src="https://unpkg.com/vue@2.5.16/dist/vue.js">
    const app = new vue({
    el: "#app",
    data: {
    product: "Boots"
    }
    })
</script>

1 个答案:

答案 0 :(得分:0)

Change vue to Vue, then works.

app = new Vue({ //not vue, it is Vue
    el: "#app",
    data: {
    product: "Boots"
    }
    })
<script src="https://unpkg.com/vue@2.5.16/dist/vue.js"></script>
<div id="app">
    <h2>{{product}}</h2>
</div>