Using Svelte components in Vue.js
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
src
test
.gitignore
.prettierignore
.prettierrc.yml
LICENSE
README.md
bili.config.js
package-lock.json
package.json
tsconfig.json
tslint.json

README.md

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