vue-svelte-adapter Svelte Themes

Vue Svelte Adapter

Using Svelte components in Vue.js

vue-svelte-adapter

Using Svelte components in Vue.js.

Usage

Install it via npm:

$ npm install vue-svelte-adapter

First, you make a Svelte component:

<p>{{ message }}</p>

<script>
export default {
  data() {
    return {
      message: 'Hello!'
    }
  }
}
</script>

Then, you import the component and toVue function from vue-svelte-component so that transform it into a Vue component.

// Your Svelte component
import Hello from './Hello.html'

// Svelte to Vue adapter
import { toVue } from 'vue-svelte-adapter'

// Return a Vue component which converted from the Svelte component
export default toVue(Hello, {
  // You can specify some Vue props to port to Svelte data
  props: {
    message: String
  }
})

License

MIT

Top categories

Loading Svelte Themes