Skip to content

Latest commit

 

History

History
56 lines (39 loc) · 1.68 KB

require-slots-as-functions.md

File metadata and controls

56 lines (39 loc) · 1.68 KB
pageClass sidebarDepth title description since
rule-details
0
vue/require-slots-as-functions
enforce properties of `$slots` to be used as a function
v7.0.0

vue/require-slots-as-functions

enforce properties of $slots to be used as a function

  • ⚙️ This rule is included in all of "plugin:vue/essential", *.configs["flat/essential"], "plugin:vue/strongly-recommended", *.configs["flat/strongly-recommended"], "plugin:vue/recommended" and *.configs["flat/recommended"].

📖 Rule Details

This rule enforces the properties of $slots to be used as a function.
this.$slots.default was an array of VNode in Vue.js 2.x, but changed to a function that returns an array of VNode in Vue.js 3.x.

<script>
export default {
  render(h) {
    /* ✓ GOOD */
    var children = this.$slots.default()
    var children = this.$slots.default && this.$slots.default()

    /* ✗ BAD */
    var children = [...this.$slots.default]
    var children = this.$slots.default.filter(test)
  }
}
</script>

🔧 Options

Nothing.

📚 Further Reading

🚀 Version

This rule was introduced in eslint-plugin-vue v7.0.0

🔍 Implementation