-
Notifications
You must be signed in to change notification settings - Fork 346
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
stops working after updating vue to 2.7 #663
Comments
I found 2.6.14 as the latest working (which is latest of 2.6). |
I ran into an issue where the minified code says " This is due to I'm currently:
|
@NightCatSama Do you want help in v4 to make it backwards compatible with Vue 2.7? I need this fixed and am doing the work locally. |
@JessicaSachs I tried [email protected] and [email protected] and no error was reported. And the 4.x beta version is for vue@3. |
The Vue 2.7 Reproduction Stackblitz is here: https://stackblitz.com/edit/vitejs-vue-2-7-slider-issue?file=package.json,src%2FApp.vue.
Your 4.x version is very close to being backwards-compatible with 2.7 because it removes the decorator syntax. You also continue to |
Just checking in. Did you have a chance to look at the reproduction I provided? |
I appear to be in a similar situation. Using Vue 2.7 to transition to Vue 3. I discovered this component last week, it's beautiful and does everything we need, except build ;) Can you elaborate or share your changes you've done? I myself tried to copy vue-slider-component lib folder into our own code base but was immediately met with nonsensical syntax errors at build time (though curiously my IDE does not see the same issue) |
Yeah so the "extend" issue is because the 3.x (Vue 2) version using In theory, the signature changes a little bit and Workaround
Diff of changes made onto `4.0.0-beta.9`diff --git a/node_modules/vue-slider-component/lib/utils/control.ts b/node_modules/vue-slider-component/lib/utils/control.ts
index b4af30f..9dd8319 100644
--- a/node_modules/vue-slider-component/lib/utils/control.ts
+++ b/node_modules/vue-slider-component/lib/utils/control.ts
@@ -1,5 +1,5 @@
import Decimal from './decimal'
-import {
+import type {
Value,
Mark,
MarkOption,
diff --git a/node_modules/vue-slider-component/lib/utils/index.ts b/node_modules/vue-slider-component/lib/utils/index.ts
index 1ec9124..5aad2d1 100644
--- a/node_modules/vue-slider-component/lib/utils/index.ts
+++ b/node_modules/vue-slider-component/lib/utils/index.ts
@@ -1,4 +1,4 @@
-import { Direction } from '../typings'
+import type { Direction } from '../typings'
interface IPosObject {
x: number
diff --git a/node_modules/vue-slider-component/lib/vue-slider-dot.vue b/node_modules/vue-slider-component/lib/vue-slider-dot.vue
index 455e822..f8e0faa 100644
--- a/node_modules/vue-slider-component/lib/vue-slider-dot.vue
+++ b/node_modules/vue-slider-component/lib/vue-slider-dot.vue
@@ -20,14 +20,15 @@
</template>
<script lang="ts">
+// @ts-nocheck
import { defineComponent, PropType } from 'vue'
-import { Value, Styles, Position, TooltipProp, TooltipFormatter } from './typings'
+import type { Value, Styles, Position, TooltipProp, TooltipFormatter } from './typings'
import './styles/dot.scss';
export default defineComponent({
name: 'VueSliderDot',
- emits: ['DragStart'],
+ emits: ['drag-start'],
props: {
value: { type: [String, Number] as PropType<Value>, default: 0 },
@@ -50,9 +51,9 @@ export default defineComponent({
disabled: { type: Boolean, default: false },
- dotStyle: { type: Object as PropType<Styles> },
+ dotStyle: { type: [Object, Array] as PropType<Styles> },
- tooltipStyle: { type: Object as PropType<Styles> },
+ tooltipStyle: { type: [Object, Array] as PropType<Styles> },
},
computed: {
dotClasses() {
@@ -122,7 +123,7 @@ export default defineComponent({
return false
}
- this.$emit('DragStart')
+ this.$emit('drag-start')
},
}
})
diff --git a/node_modules/vue-slider-component/lib/vue-slider-mark.vue b/node_modules/vue-slider-component/lib/vue-slider-mark.vue
index f77b1e3..c8e8efa 100644
--- a/node_modules/vue-slider-component/lib/vue-slider-mark.vue
+++ b/node_modules/vue-slider-component/lib/vue-slider-mark.vue
@@ -32,14 +32,15 @@
</template>
<script lang="ts">
+// @ts-nocheck
import { defineComponent, PropType } from 'vue'
-import { Mark, Styles } from './typings'
+import type { Mark, Styles } from './typings'
import './styles/mark.scss';
export default defineComponent({
name: 'VueSliderMark',
- emits: ['PressLabel'],
+ emits: ['press-label'],
props: {
mark: {
type: Object as PropType<Mark>,
@@ -48,13 +49,13 @@ export default defineComponent({
hideLabel: { type: Boolean },
- stepStyle: { type: Object as PropType<Styles> },
+ stepStyle: { type: [Object, Array] as PropType<Styles> },
- stepActiveStyle: { type: Object as PropType<Styles> },
+ stepActiveStyle: { type: [Object, Array] as PropType<Styles> },
- labelStyle: { type: Object as PropType<Styles> },
+ labelStyle: { type: [Object, Array] as PropType<Styles> },
- labelActiveStyle: { type: Object as PropType<Styles> },
+ labelActiveStyle: { type: [Object, Array] as PropType<Styles> },
},
computed: {
marksClasses() {
@@ -85,7 +86,7 @@ export default defineComponent({
methods: {
labelClickHandle(e: MouseEvent | TouchEvent) {
e.stopPropagation()
- this.$emit('PressLabel', this.mark.pos)
+ this.$emit('press-label', this.mark.pos)
},
}
})
diff --git a/node_modules/vue-slider-component/lib/vue-slider.vue b/node_modules/vue-slider-component/lib/vue-slider.vue
index 38bd739..b27283b 100644
--- a/node_modules/vue-slider-component/lib/vue-slider.vue
+++ b/node_modules/vue-slider-component/lib/vue-slider.vue
@@ -42,7 +42,7 @@
:stepActiveStyle="stepActiveStyle"
:labelStyle="labelStyle"
:labelActiveStyle="labelActiveStyle"
- :onPressLabel="(pos: number) => clickable && setValueByPos(pos)"
+ @press-label="pos => clickable && setValueByPos(pos)"
>
<template v-slot:step><slot name="step" v-bind="mark"></slot></template>
<template v-slot:label><slot name="label" v-bind="mark"></slot></template>
@@ -102,10 +102,11 @@
</template>
<script lang="ts">
+// @ts-nocheck
import { defineComponent, PropType } from 'vue'
import VueSliderDot from './vue-slider-dot.vue'
import VueSliderMark from './vue-slider-mark.vue'
-import {
+import type {
Value,
DataObject,
MarksProp, |
Thank you very much @JessicaSachs |
@NightCatSama I have a GitHub monorepo template called Petite which tries to help library authors deploy the same backwards compatible source-code for Vue 2.7 and Vue 3 users by cross-compiling it with different versions of the Vite compiler. I use it internally at work for our Design System. The template is here: https://github.com/JessicaSachs/petite and it uses Vitepress for its documentation, Vitest for tests, and also supports linting to warn you if you're using features that are Vue 3-only. I know you're busy. Do you want some help with this repo? |
Hi everyone, so I installed Thank you all again. I look forward to the next stable version of vue-slider-component as it is the best of its kind that I've been able to find. |
@JessicaSachs It seems that there is no good way to fix the problem on [email protected] for now. I have tried the solution to this issue and it works. But it may have an impact on other dependencies. #642
|
resolveComponent is not a function |
I ran into the same issue and after re-reading through some of the comments you need to import
I'm using |
After updating vue 2.7 component produces this error:
The text was updated successfully, but these errors were encountered: