Vuep (vue playground)
🎡 A component for rendering Vue components with live editor and preview.
Links
- Docs: https://cinwell.com/vuep/
- An online playgound: https://vuep.run
Installation
Yarn
yarn add vuep codemirror# npm i vuep codemirror -S
HTML tag
<!-- Import theme --> <!-- depend vue -->
Quick start
Need the full (compiler-included) build of Vue
webpack config
alias: 'vue$': 'vue/dist/vue.common'
Vue// or Vue.component('Vuep', Vuep) el: '#app' { thiscode = ` <template> <div>Hello, {{ name }}!</div> </template> <script> module.exports = { data: function () { return { name: 'Vue' } } } </script> ` }
Usage A
Usage B
you can write in HTML file or even a markdown file.
Scope
You can customize scope by passing an object to the scope property.
This object can contain component available in main scope to include them into Vuep.
- features.js: Component to showcase into Vuep
props: features: Array template: `<div class="features"><h3>Features</h3><ul> <li v-for="feature in features">{{ feature }}</li></ul></div>`
- app.js: Application that needs to showcase Features component through Vuep
el: '#app' { return scope: Features // Set the scope of vuep value: `<template> <div> <features :features="features"></features> </div></template> <script> export default { components: { Features // This variable is available through scope and can be used to register component }, data () { return { features: [ 'Vue Single File Component support', 'Scoped style', 'UMD and CommonJS build', 'Define JavaScript scope' ] } } }<\/script>` }
- app template:
Inspired
- https://facebook.github.io/react/
- https://github.com/FormidableLabs/component-playground
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