Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upRule Proposal: no-use-v-if-with-v-slot #1273
Comments
Thank you for the rule suggestion. What happens to this rule in the following cases? <template
v-slot="scope"
v-if="show"
>
<span>{{scope.msg}}</span>
</template> If this is an error, why is it an error? <template>
<MyComp>
<template
v-slot="scope"
v-if="scope.show"
>
<span>{{scope.msg}}</span>
</template>
</MyComp>
</template>
<script>
export default {
data () {
return {
scope: {
show: true // v-if uses this data.
}
}
}
}
</script> Perhaps I think extending <template>
<MyComp>
<template
v-slot="scope"
v-if="scope.show /* <- scope is shadowing */"
>
<span>{{scope.msg}}</span>
</template>
</MyComp>
</template> However, the parser may not parse it right now. |
Please describe what the rule should do:
disallow use v-if on the same element as v-slot
What category should the rule belong to?
Provide 2-3 code examples that this rule should warn about:
Additional context
vue#11574