All Projects → JounQin → vue-dynamic

JounQin / vue-dynamic

Licence: MIT license
Load stringified or normal Vue components dynamically!

Programming Languages

typescript
32286 projects
shell
77523 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to vue-dynamic

Vue Json Edit
Visual JSON editor built as an vue component. Provides a basic GUI
Stars: ✭ 207 (+370.45%)
Mutual labels:  vue-components
Vue Glide
A slider and carousel as vue component on top of the Glide.js
Stars: ✭ 225 (+411.36%)
Mutual labels:  vue-components
Vueonrails
💎 Rails gem with the power of Vue.js components
Stars: ✭ 250 (+468.18%)
Mutual labels:  vue-components
Amaze Vue
一只基于amazeui样式封装的vue组件库。万水千山总是情,点个star再走行不行~~~
Stars: ✭ 211 (+379.55%)
Mutual labels:  vue-components
Web designer
网页设计器图形化工具,通过拖拽组件进行页面排版和生成页面代码
Stars: ✭ 219 (+397.73%)
Mutual labels:  vue-components
Vue Signature Pad
🖋 Vue Signature Pad Component
Stars: ✭ 237 (+438.64%)
Mutual labels:  vue-components
Heyui
🎉UI Toolkit for Web, Vue2.0 http://www.heyui.top
Stars: ✭ 2,373 (+5293.18%)
Mutual labels:  vue-components
revue
Revue provides a helpful interface for testing Vue components
Stars: ✭ 16 (-63.64%)
Mutual labels:  vue-components
Vuemmerce
👉 Responsive ecommerce template 🛒 built with Vue.js and Nuxt.js
Stars: ✭ 223 (+406.82%)
Mutual labels:  vue-components
Vue Ui Framework
My personal collection of Vue UI framework
Stars: ✭ 245 (+456.82%)
Mutual labels:  vue-components
V Bar
The virtual responsive crossbrowser scrollbar component for VueJS 2x
Stars: ✭ 216 (+390.91%)
Mutual labels:  vue-components
Vue Lazy Render
A vue component for lazy rending vue component
Stars: ✭ 219 (+397.73%)
Mutual labels:  vue-components
Vue Tabs
Simplified bootstrap tabs
Stars: ✭ 241 (+447.73%)
Mutual labels:  vue-components
Vue Nestable
A simple drag & drop hierarchical list made as a vue component.
Stars: ✭ 209 (+375%)
Mutual labels:  vue-components
Vue Form Json Schema
Create forms using JSON schema. Bring your components!
Stars: ✭ 253 (+475%)
Mutual labels:  vue-components
Vuent
🎨 Vue.js components implementing Microsoft Fluent Design
Stars: ✭ 207 (+370.45%)
Mutual labels:  vue-components
Vue Material Kit
Vue Material Kit - Open Source Material Design UI Kit
Stars: ✭ 231 (+425%)
Mutual labels:  vue-components
VueXcode
Syntax highlighting for .Vue components and .mustache templates in Xcode
Stars: ✭ 25 (-43.18%)
Mutual labels:  vue-components
Element
A Vue.js 2.0 UI Toolkit for Web
Stars: ✭ 51,416 (+116754.55%)
Mutual labels:  vue-components
Wdui
Mobile UI Components Library based on Vue 2.0 at Weidian
Stars: ✭ 244 (+454.55%)
Mutual labels:  vue-components

vue-dynamic

GitHub Actions Codacy Grade npm GitHub Release

David Peer David David Dev

Conventional Commits Renovate enabled JavaScript Style Guide Code Style: Prettier codechecks.io

Load stringified or normal Vue components dynamically!

TOC

Notice

This module is just a simple wrapper of Vue's built-in component, and you should only use it to use stringified static components.

Usage

1.Global Component

import Vue from 'vue' // make sure to use 'vue/dist/vue.js' because we will use template
import VueDynamic from 'vue-dynamic'

Vue.use(VueDynamic, { name: 'dynamic' }) // you can custom the global component name and it's default name is 'dynamic'

Then it will be same with the next case:

2.Specific Component

<template>
  <Dynamic :comps="comps" :emptyView="emptyView" />
</template>
<script>
import { Dynamic } from 'vue-dynamic' // if we choose to use the first case, you don't need to import this component again
import NoItem from 'components/NoItem'

export default {
  name: 'VueDynamic',
  data() {
    return {
      comps: this.$route.meta.data,
      emptyView: NoItem,
    }
  },
  components: {
    Dynamic,
  },
}
</script>

It needs you to pass two props to Dynamic, emptyView is required because it will be used when we failed to pass your comps.

comps can be a Object like the normal components option in *.vue file of an Array of Vue-Component-like Object.

There is a deadly simple example:

;[
  {
    template: `<div>{{ msg }}</div>`,
    data: {
      msg: `It's the first dynamic template!`,
    },
  },
  {
    template: `<div>{{ reverse ? $options.filters.reverse(msg) : msg }}
<button class="btn btn-primary" @click="reverseMsg">Try to reverse me!</button></div>`,
    data: {
      msg: `It's the second dynamic template!`,
      reverse: false,
    },
    methods: {
      reverseMsg: 'this.reverse = !this.reverse',
    },
  },
  {
    template: `<div>More Magic Here!</div>`,
  },
]

As you see, the value of methods object is a string (or array, them will be applied to Function constructor) what means you can store it in your database! So that it is possible to define customer defined page component separately and link them together at once!

It's very useful to build a html5 page like eqxiu.com.

And nested components can be used! Here is a example:

;[
  {
    template: '<div><component1/><component2/></div>',
    components: {
      component1: {
        template: '<div @click="click">{{ msg }}</div>',
        data: {
          msg: 'Inner Message',
        },
        methods: {
          click: 'alert("abc")',
        },
      },
      component2: {
        template: '<div @click="click">{{ msg }}<component3/></div>',
        data: {
          msg: 'Inn1222er Message',
        },
        methods: {
          click: 'alert("ab11c")',
        },
        components: {
          component3: {
            template: `<button @click="reverse">{{ msg }}</button>`,
            data: {
              msg: `I'm the third one!`,
            },
            methods: {
              reverse: `this.msg = this.msg.split('').reverse().join('')`,
            },
          },
        },
      },
    },
  },
]

The nested components can also be an array and use a name option in component which is used in you template.

Changelog

Detailed changes for each release are documented in CHANGELOG.md.

License

MIT © JounQin@1stG.me

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].