2

When using script setup syntax with Typescript in Vue 3, how can I set a component's options to disable attribute inheritance?

JavaScript code:

app.component('date-picker', {
  inheritAttrs: false,
  // [..]
})

Script setup with Typescript:

<script setup lang="ts">
// how can I set inheritAttrs here?
</script>

1 Answer 1

2

Found the solution here: https://v3.vuejs.org/api/sfc-script-setup.html#usage-alongside-normal-script

<script setup> can be used alongside normal <script>. A normal <script> may be needed in cases where you need to:

Declare options that cannot be expressed in <script setup>, for example inheritAttrs or custom options enabled via plugins.

So this did the job:

<script lang="ts">
export default {
  inheritAttrs: false,
}
</script>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.