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

Stuck trying to import and use with Vite #74

Open
jerryComo opened this issue Mar 20, 2023 · 2 comments
Open

Stuck trying to import and use with Vite #74

jerryComo opened this issue Mar 20, 2023 · 2 comments

Comments

@jerryComo
Copy link

I used to have this working fine before we were using Vite Now I can't seem to integrate it without it causing errors ( I think this is down to how I've defined the slider. Nothing shows up, and I get "Component is missing template or render function." in the warnings.

import Slider from '@vueform/slider';
const slider = shallowRef({value:0});

defineProps({
slider: {value: 30 },
});

then within the tags I'm referencing it like so

the version is in the package.json as "@vueform/slider": "^2.1.7". Any help sorting this mucho appreciate :)

@phuze
Copy link

phuze commented Oct 31, 2023

Your issue is unrelated to Vite.
To import and use the slider in a Vue 3 + Vite project, use a reactive() object.
@jerryComo please mark your issue as closed, if this helped to resolve your issue.

<script setup>
import { reactive } from "vue"
import VueformSlider from "@vueform/slider"

const vueformSliderState = reactive({
  value: 30
})
</script>

<style lang="scss">
@import "@vueform/slider/themes/default.css";
</style>

<template>
  <div>
    <VueformSlider
      v-model="vueformSliderState.value"
      :min="0"
      :max="2000"
      :step="1" />
  </div>
</template>

@att1sb
Copy link

att1sb commented Dec 22, 2023

@phuze importing the file within the style tags worked, whereas before it was working by simply importing in the script tag.

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

3 participants