sagalbot / vue-select

Everything you wish the HTML <select> element could do, wrapped up into a lightweight, extensible Vue component.
https://vue-select.org
MIT License
4.62k stars 1.33k forks source link

Error occurs when using it with Vue.defineCustomElement #1792

Open kounetsuman opened 10 months ago

kounetsuman commented 10 months ago

Please respect maintainers time by filling in these sections. Your issue will likely be closed without this information.

Describe the bug A clear and concise description of what the bug is.

→An error occurs when using it with a custom element

Uncaught TypeError: Cannot read properties of undefined (reading 'header')
    at Proxy.ve (vue-select.es.js:656:189)
    at renderComponentRoot (runtime-core.esm-bundler.js:935:16)
    at ReactiveEffect.componentUpdateFn [as fn] (runtime-core.esm-bundler.js:5774:46)
    at ReactiveEffect.run (reactivity.esm-bundler.js:217:19)
    at instance.update (runtime-core.esm-bundler.js:5887:51)
    at setupRenderEffect (runtime-core.esm-bundler.js:5895:5)
    at mountComponent (runtime-core.esm-bundler.js:5685:5)
    at processComponent (runtime-core.esm-bundler.js:5638:9)
    at patch (runtime-core.esm-bundler.js:5126:11)
    at mountChildren (runtime-core.esm-bundler.js:5370:7)

Reproduction Link A link to a reproduction of the bug. This is a huge help.

→ nothing

Steps To Reproduce Outline the steps to reproduce the bug.

→Occurs with the following implementation

SelectItem.vue

<template>
  <v-select :options="options" />
</template>

<script setup>
import vSelect from 'vue-select';

const options = [
  { text: 'Option 1', value: 1 },
  { text: 'Option 2', value: 2 },
  { text: 'Option 3', value: 3 },
];
</script>

Parent.js

import SelectItem from './SelectItem.vue';

const element = defineCustomElement(SelectItem);
window.customElements.define('p-select-item', element);

index.html

<p-select-item></p-select-item>

Expected behavior A clear and concise description of what you expected to happen.

→used in Vue.defineCustomElement

Screenshots If applicable, add screenshots to help explain your problem.

→ nothing