guyaloni
guyaloni

Reputation: 5862

Vue dynamically generate slots

I need to generate slots from an array which I create dynamically.

I manage to do so with this code:

<template v-for="(department,id) in departments" v-slot:[id]="record">
    <template v-if="record.departments.includes(id)">
        <i class="fas fa-check text-success"></i>
    </template>
</template>

However, PhpStorm doesn't like it, and I get the following error:

http://www.w3.org/19999/XSL/Transform? Alt+Enter

Namespace 'v-slot' is not bound
This inspection checks for unbound namespace prefixes in XML.

enter image description here

enter image description here

I use Vue version 2.6.10 and PhpStorm 2017.3.6

In terms of functionality, everything is fine, so I guess it is just a generic warning of PhpStorm.
Any idea how can I disable it?

Upvotes: 0

Views: 255

Answers (1)

lena
lena

Reputation: 93748

The IDE version you are using provides no support for Vue.js slots; this particular issue (WEB-37732) is fixed in 2019.2; full support for slots is available since 2019.3 (but the slots generated dynamically won't be completed/resolved, the IDE static code analysis can't handle the stuff only available in runtime).

You can disable the XML | Unbound XML namespace prefix inspection as workaround

Upvotes: 1

Related Questions