Vuepic / vue-datepicker

Datepicker component for Vue 3
https://vue3datepicker.com
MIT License
1.4k stars 137 forks source link

Failed to resolve component #847

Closed fishj123 closed 2 months ago

fishj123 commented 3 months ago

When using the component in the browser, it doesn't load. The console has the following error message:

[Vue warn]: Failed to resolve component: vuedatepicker If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement. at

Example code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="https://unpkg.com/@vuepic/vue-datepicker@latest/dist/main.css">
</head>
<body>

<script src="https://unpkg.com/vue@latest"></script>
<script src="https://unpkg.com/@vuepic/vue-datepicker@latest"></script>
<div id="app">
  {{ message }}
  <VueDatePicker ></VueDatePicker>
</div>

<script>
  const { createApp, ref, onMounted, onUnmounted } = Vue;

  createApp({
    components: { VueDatePicker },
    setup() {
      const message = ref("Hello vue!");
      onMounted(() => {
        console.log(`the component is now mounted.`);
      });
      return {
        message,
      };
    },
  }).mount("#app");
</script>
</body>
</html>
Jasenkoo commented 2 months ago

@fishj123 When using inside static HTML, the component has to be added as <vue-date-picker></vue-date-picker>. I will update this in the documentation.