Vue Attribute is not allowed here

Hello,  recently  I was using vue without any issue with previous versions of phpstorm

 

but now after latest update I get 

Attribute v-model is not allowed here

 

Also there's no autocomplete for vue component in html file 

 

How can make phpstorm support vue like before ?

0
14 comments

Is the Vue.js plugin enabled at Settings | Plugins?

0

What file is it - .vue or .html?

Vue.js plugin only supports single-file components with a .vue extension (https://vuejs.org/v2/guide/single-file-components.html). Components in .html files are not supported, Vue.js directives are not recognized there... And it is unlikely that they will be supported in future

0

Hello, it's  html and the plugn on activated,  it was working in previous builds but not in new one that's why I asked. 

0

As I wrote, Vue components in .html files are not supported; Vue.js plugin only works for components defined in .vue files

0

Elena, a lot of people use vue outside of .vue files - really, a lot!

.vue files are typically used in single page apps, but most projects where vue is used as "sugar on top" with a regular website do just add them to html (twig, blade, ...) files. Single file components are an optional feature of Vue.

Please consider adding support for this - this is a complete deal breaker for me and I'm sure many others. I won't be able to use PHPStorm any longer and am stuck on the previous version.

4

Please vote for https://youtrack.jetbrains.com/issue/WEB-32274 and https://youtrack.jetbrains.com/issue/WEB-32255 to be notified on any progress with these features.

To be frank, we don’t have any immediate plans to provide support for components in .html/.php etc. files. To provide a good development experience for these components, we need to invest significant resources and right now we want to keep our focus on improving for support for the more commonly used single-file components, there’re still a lot of things we need to do in this area.

0

Hi, given that you won't be supporting vue in .html files for the forseeable future (very disappointing), can you please advise how to stop intellij IDEA from showing the vue tags as invalid at least?

0

IDEA normally suggests adding unknown attributes/tags to the list of custom elements: hit Alt+Enter on highlighted tag, choose to add it to custom HTML tags:

0

For those looking for an answer.. 

Just create a package.json on the root directory of your project, and require vue package on the dependencies. it will work fine even without running npm install.

This is how my package.json sample looked like :

 

Thanks!

7

Newrehmi Thank you! This is much better than any of the other answers!

2

This shouldn't be necessary when using the recent Webstorm version... Vue components in HTML files are supported, even when using Vue library referenced via CDN link. You just need to use Download library quickfix to download the library files

1

was looking for the fix to the same issue today and surprised that i wrote the answer myself last year :)

i'll probably be back again next year ;)

1

Please sign in to leave a comment.