astro/packages/renderers/renderer-vue/client.js
Nate Moore ac3e870280
fix: renderer behavior with no children (#2078)
* fix: renderer behavior with no children

* [ci] Prettier fix

* Force CI

* fix: properly handle falsy values

* [ci] Prettier fix

* chore: force ci

* [experiment] netlify ignore

Co-authored-by: GitHub Action <github-action@users.noreply.github.com>
2021-12-02 10:30:15 -06:00

14 lines
515 B
JavaScript

import { h, createSSRApp } from 'vue';
import StaticHtml from './static-html.js';
export default (element) => (Component, props, children) => {
delete props['class'];
// Expose name on host component for Vue devtools
const name = Component.name ? `${Component.name} Host` : undefined;
const slots = {};
if (children != null) {
slots.default = () => h(StaticHtml, { value: children });
}
const app = createSSRApp({ name, render: () => h(Component, props, slots) });
app.mount(element, true);
};