Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Throws error related to TableDate when combined with @vue/compat #41

Open
jschill opened this issue Apr 27, 2023 · 10 comments
Open

Comments

@jschill
Copy link

jschill commented Apr 27, 2023

Vue-datepicker-next version: 1.0.3
Vue version: 3.2.47
Browser: All

Steps to reproduce
Create a new vue-project (npm create vue@3). I did not select any specials, such as typescript, pinia, linting, testing... Just the bare minimal.

Add vue-datepicker-next.
Created a new route for the picker. And pasted the example:

<script>
  import DatePicker from 'vue-datepicker-next';
  import 'vue-datepicker-next/index.css';

  export default {
    components: { DatePicker },
    data() {
      return {
        time0: null,
        time1: null,
        time2: null,
        time3: null,
      };
    },
  };
</script>

<template>
  <div>
    <date-picker v-model:value="time0"></date-picker>
    <date-picker v-model:value="time1" type="datetime"></date-picker>
    <date-picker v-model:value="time2" valueType="format"></date-picker>
    <date-picker v-model:value="time3" range></date-picker>
  </div>
</template>

Everything works just fine and the picker works.

Adding @vue/compat as dependency and adding the changes for it in vite.config.js:

import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({

  plugins: [vue({
    template: {
      compilerOptions: {
        compatConfig: {
          MODE: 2
        }
      }
    }
  })],
  resolve: {
    alias: {
      vue: '@vue/compat',
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  }
})

Then the pickers stop working.

Screenshot 2023-04-27 at 09 52 44

When i'm debugging TableDate, the arguments passed in are two functions, not a TableDateProps object. They are coming from convertLegacyAsyncComponent:

Screenshot 2023-04-27 at 11 46 26

@fanta759
Copy link

fanta759 commented Jun 2, 2023

Hi, i have the same issue, do you find any solution ?

@jschill
Copy link
Author

jschill commented Jun 2, 2023

Hi, i have the same issue, do you find any solution ?

@fanta759 No, sorry. vue-compat did not fill all the holes we wanted, so we had to change our upgrade strategy to a new one that does not include vue-compat.

@vhatsura
Copy link

vhatsura commented Jun 5, 2023

I was managed to fix this specific issue disabling COMPONENT_ASYNC feature using

import { configureCompat } from 'vue'

// disable compat for certain features
configureCompat({
  COMPONENT_ASYNC: false,
})

however, after that I get the following error when selecting date:

vue.runtime.esm-bundler.js:1638 Uncaught TypeError: onSelect is not a function
    at handleCellClick (index.es.js:926:5)
    at callWithErrorHandling (vue.runtime.esm-bundler.js:1575:18)
    at callWithAsyncErrorHandling (vue.runtime.esm-bundler.js:1583:17)
    at HTMLTableCellElement.invoker (vue.runtime.esm-bundler.js:11171:5)

@Leftyx
Copy link

Leftyx commented Nov 20, 2023

@fanta759, @jschill I am having the same issue. Did you manage to make it work at the end ?

@fanta759
Copy link

@Leftyx I use another datetimepicker

@Leftyx
Copy link

Leftyx commented Nov 20, 2023

@Leftyx I use another datetimepicker

@fanta759 , Thanks for the swift reply. Appreciated. Which alternative did you use ?

@yujin1st
Copy link

yujin1st commented Dec 7, 2023

also stumbled upon this issue, didn't find the solution

@kazuyoshi-yamada-wmj
Copy link

any update? i have same issue.

@fanta759
Copy link

@Leftyx @yujin1st @kazuyoshi-yamada-wmj
I use this datetimepicker with Vue3 : https://vue3datepicker.com/

@Kasopej
Copy link

Kasopej commented Dec 17, 2024

having a similar error props[""onUpdate:value] is not a function
Which seems to indicate it is expecting a custom function handler with name of "onUpdate:value" but looking at the docs that doesn't seem to be the case.. also actually passing the props does not fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants