2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-06-05 16:42:27 +03:00
Files
bbob/packages/bbob-vue2/src/Component.ts
T
Nikolay Kost 270f5645f8 fix(#206): TagNode.create now with null content argument by default (#233)
* fix: TagNode.create with null content by default

* Create five-meals-sing.md

* fix: tests

* fix(preset): types inference

* fix: preset types

* fix: preset types

* fix: lock file, parser and utils

* refactor: move types to separate package

* fix(preset): add @bbob/core to dev deps

* fix(preset): lock file

* test(preset-vue): create tags

* test(preset-vue): tests

* chore(nx): fix nx cover deps

* chore: changesets
2024-06-24 01:32:15 +03:00

41 lines
813 B
TypeScript

import { defineComponent } from 'vue';
import type { BBobCoreOptions, BBobPlugins } from '@bbob/types';
import { render } from './render';
export type BBobVueComponentProps = {
container: string
plugins?: BBobPlugins
options?: BBobCoreOptions
}
const Component = defineComponent<BBobVueComponentProps>({
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;