简体   繁体   English

VSCode 无法识别<transition>元素

[英]VSCode doesn't recognize <transition> element

For some reason my VSCode has highlighted the transition element in red, which I take to mean it doesn't recognize this element.出于某种原因,我的 VSCode 以红色突出显示了过渡元素,我认为这意味着它无法识别该元素。 I'm not really sure what's going on here.我不确定这里发生了什么。 And the code also doesn't work in that there is no transition or even any change with clicking the button at all.并且代码也不起作用,因为单击按钮根本没有过渡甚至任何更改。 Thanks for your help!谢谢你的帮助!

 <!--Vuejs CDN--> <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script> <title>Hello, world!</title> </head> <body> <div id='app'> <button v-on:click='showThis = !showThis'>Swap</button> <transition name='fade'> <p v-if='showThis'>Then showThis is true!</p> </transition> </div> <!-- Vuejs --> <script> new Vue({ el:'#app', data:{ showThis:true } }) </script> <style> .fade-enter-active, .fade-leave-active { transition: opacity .5s; } .fade-enter, .fade-leave-to { opacity: 0; } </style> <!-- Optional JavaScript --> <!-- jQuery first, then Popper.js, then Bootstrap JS --> <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"

crossorigin="anonymous"> crossorigin="匿名">

Just check by adding the following lines in User Settings.只需在用户设置中添加以下行进行检查。 Files->Preferences->Settings->User Settings文件->首选项->设置->用户设置

"editor.formatOnSave": true, "eslint.validate": [ "javascript", "javascriptreact", "vue" ] "editor.formatOnSave": true, "eslint.validate": [ "javascript", "javascriptreact", "vue"]

I believe it is your tag that is just a closing tag.我相信你的标签只是一个结束标签。 Try creating <head></head> open and closing pair.尝试创建<head></head>开闭对。

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

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