• Stars
    star
    886
  • Rank 51,520 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 8 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🎡 A component for rendering Vue components with live editor and preview.

Vuep (vue playground)

Build Status Coverage Status npm

🎡 A component for rendering Vue components with live editor and preview.

image

Links

Installation

Yarn

yarn add vuep codemirror
# npm i vuep codemirror -S

HTML 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 write 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>

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
export default {
  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
import Vue from 'vue'

import Features from 'features' // Import component

new Vue({
  el: '#app',
  data: function () {
    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:
<div id="app">
  <vuep :value="value" :scope="scope"></vuep>
</div>

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

More Repositories

1

vue-trend

🌈 Simple, elegant spark lines for Vue.js
JavaScript
1,191
star
2

vue-markdown-loader

📇 Convert Markdown file to Vue2.0 component.
JavaScript
702
star
3

laue

🖖📈 Modern charts for Vue 2.0
JavaScript
263
star
4

vuerify

🚩Validation plugin for Vue.js
JavaScript
191
star
5

vue-region-picker

[DEPRECATED]
JavaScript
158
star
6

vuep.run

🏃 An online playground for Vue2.0
Vue
140
star
7

npmarket

🛒 More efficient search for node packages.
Vue
93
star
8

jsdoc-vue

[➡️ https://github.com/Kocal/jsdoc-vuejs] A jsdoc plugin that parses *.vue files.
Vue
69
star
9

vue-tricks

Vue
47
star
10

donate

❤️ Donate to @QingWei-Li
24
star
11

pue-loader

🐍 A more pythonic javascript for Vue component file. (Pug + CoffeeScript + Stylus)
JavaScript
20
star
12

vue-delay

🐌 Delay rendering component for Vue.js
JavaScript
17
star
13

typer

✍️ A simplified publishing tool
TypeScript
12
star
14

vueo

🍟 Easy to get value from vue instance via object paths.
JavaScript
10
star
15

hostext

🔡 Text hosting service
JavaScript
9
star
16

vuetch

👻 [WIP]A Vue 2.0 component that fetches data from a http request.
JavaScript
8
star
17

theme-color

Material theme color generator.
JavaScript
7
star
18

2webpack2

🕳️ Turn configuration of webpack 1 to 2
JavaScript
5
star
19

buble-jest

Jest plugin to use buble and babel(handle ES Modules) for transformation
JavaScript
5
star
20

highlightext

💡 Highlight text service
JavaScript
4
star
21

noop-webpack-plugin

🤷‍♀️ Webpack plugin that does nothing.
JavaScript
4
star
22

nft-swag

TypeScript
3
star
23

pue-syntax-highlight

Sublime Text syntax highlighting for single-file Vue components
3
star
24

htpl

A JavaScript templating engine uses Vue syntax.
TypeScript
3
star
25

vuea

🍔 Easy to drop or replace specified key in an array.
JavaScript
2
star
26

AutoBackupFolder

定时打包备份指定文件夹的程序
C#
2
star
27

MagicCubeReduction-CFOP

用cfop还原魔方, 第一个c#开发的程序,留个念想
C#
2
star
28

Aha

[DEPRECATED] 魔兽世界拍卖行辅助工具(客户端)
JavaScript
2
star
29

ablog

A homework orz
TypeScript
2
star
30

qingwei-li.github.io

HTML
1
star
31

sort

一些sort算法练习
JavaScript
1
star
32

parsedate

Converts a value to a Date
JavaScript
1
star
33

Polish

[DEPRECATED]
JavaScript
1
star
34

global-bin-path

DEPRECATED
JavaScript
1
star
35

site

1
star