🎡 A component for rendering Vue components with live editor and preview.
https://qingwei-li.github.io/vuep/
yarn add vuep codemirror
# npm i vuep codemirror -S
<!-- Import theme -->
<link rel="stylesheet" href="//unpkg.com/vuep/dist/vuep.css">
<!-- depend vue -->
<script src="//unpkg.com/vue"></script>
<script src="//unpkg.com/vuep"></script>
Need the full (compiler-included) build of Vue
webpack config
{
alias: {
'vue$': 'vue/dist/vue.common'
}
}
import Vue from 'vue'
import Vuep from 'vuep'
import 'vuep/dist/vuep.css'
Vue.use(Vuep /*, { codemirror options } */)
// or Vue.component('Vuep', Vuep)
new Vue({
el: '#app',
created: function () {
this.code = `
<template>
<div>Hello, {{ name }}!</div>
</template>
<script>
module.exports = {
data: function () {
return { name: 'Vue' }
}
}
</script>
`
}
})
<div id="app">
<vuep :template="code"></vuep>
</div>
you can written in HTML file or even a markdown file.
<div id="app">
<vuep template="#example"></vuep>
</div>
<script v-pre type="text/x-template" id="example">
<template>
<div>Hello, {{ name }}!</div>
</template>
<script>
module.exports = {
data: function () {
return { name: 'Vue' }
}
}
</script>
</script>
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
yarn && yarn dev
# npm i && npm run dev
open test.html
MIT