@hongluan-ui/vue-repl
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

@vue/repl

Vue SFC REPL as a Vue 3 component.

fork from vue-repl@1.3.0

support for compiling simple sass/scss files

Simple Usage

<script setup>
import { Repl } from '@vue/repl'
import '@vue/repl/style.css'
</script>

<template>
  <Repl />
</template>

Advanced Usage

<script setup>
import { watchEffect } from 'vue'
import { Repl, ReplStore } from '@vue/repl'

const store = new ReplStore({
  // initialize repl with previously serialized state
  serializedState: location.hash.slice(1),

  // specify the default URL to import Vue runtime from in the sandbox
  // default is the CDN link from unpkg.com with version matching Vue's version
  // from peerDependency
  defaultVueRuntimeURL: 'cdn link to vue.runtime.esm-browser.js'
})

// persist state to URL hash
watchEffect(() => history.replaceState({}, '', store.serialize()))

// pre-set import map
store.setImportMap({
  imports: {
    myLib: 'cdn link to esm build of myLib'
  }
})

// use a specific version of Vue
store.setVueVersion('3.2.8')
</script>

<template>
  <Repl :store="store" :showCompileOutput="true" />
</template>

Readme

Keywords

none

Package Sidebar

Install

npm i @hongluan-ui/vue-repl

Weekly Downloads

1

Version

1.0.5

License

MIT

Unpacked Size

1.08 MB

Total Files

6

Last publish

Collaborators

  • cestc-aqyj