Vuep (vue playground)
🎡 A component for rendering Vue components with live editor and preview.
Try it!
https://qingwei-li.github.io/vuep/
Installation
Yarn
yarn add vuep codemirror
# npm i vuep codemirror -SHTML tag
<!-- 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>
Quick start
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> ` } })
Usage A
<div id="app"> <vuep :template="code"></vuep> </div>
Usage B
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>
Inspired
Contributing
- 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
Development
yarn && yarn dev # npm i && npm run dev open test.html
LICENSE
MIT
