mirror of
https://github.com/tenrok/BBob.git
synced 2026-06-17 19:21:20 +03:00
cbccbaf896
* chore: initial setup for vue2 packages * feat: basic Vue 2 Component * feat(vue2): add more test cases * test(preset): add more cases to test in preset * test(preset-vue2): add more cases to test tags processing * fix(preset): tag node checking * test(preset-vue): more coverage for vue preset * refactor(vue2): move default export to plugin install func * feat(example-vue2): add vue2 example to examples folder * chore(example-vue2): remove unused npm scripts * chore: add vue 2 example in main README * chore: update package.json descriptions
34 lines
591 B
JavaScript
34 lines
591 B
JavaScript
import Vue from 'vue';
|
|
|
|
import { render } from './render';
|
|
|
|
const Component = Vue.extend({
|
|
props: {
|
|
container: {
|
|
type: String,
|
|
default: 'span',
|
|
},
|
|
plugins: {
|
|
type: Array,
|
|
},
|
|
options: {
|
|
type: Object,
|
|
},
|
|
},
|
|
|
|
render(createElement) {
|
|
if (this.$slots.default) {
|
|
const source = this.$slots.default.reduce((acc, vnode) => acc + vnode.text, '');
|
|
|
|
return createElement(
|
|
this.container,
|
|
render(createElement, source, this.plugins, this.options),
|
|
);
|
|
}
|
|
|
|
return null;
|
|
},
|
|
});
|
|
|
|
export default Component;
|