简体   繁体   English

vue.js 不适用于我的第一个测试 html 页面

[英]vue.js not working with my first test html page

I am trying to check how to vue.js javascript works.That's also not working for me.Any one like to share what is wrong with html page or what am missing here.我正在尝试检查 vue.js javascript 如何工作。这对我也不起作用。任何人都喜欢分享 html 页面有什么问题或这里缺少什么。

CODE :代码 :

<!DOCTYPE html>

    <div id="app">
        <h1>{{ greeting }}</h1>
    </div>
    <script src="https://vuejs.org/js/vue.js"/></script>
    <script>
        new Vue({
            e1: '#app',
            data: {
                greeting : 'Hello from ankit using vue.js!'
            }
        }); 
    </script>

Current Output of above code in chrome : chrome 中上述代码的当前输出:

{{ greeting }} {{问候}}

Expecting output :期待输出:

Hello from ankit using vue.js!来自 ankit 的 Hello,使用 vue.js!

Anyone like to share what is wrong with my code ?有人喜欢分享我的代码有什么问题吗? Please note ,I also cleared cache from browser.请注意,我还从浏览器中清除了缓存。

You're making a typo, you should have el instead of e1你打错字了,你应该用el而不是e1

 <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.16/vue.js"></script> <div id="app"> <h1>{{ greeting }}</h1> </div> <script> new Vue({ el: '#app', data() { return{ greeting : 'Hello from ankit using vue.js!' } } }); </script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM