summaryrefslogtreecommitdiff
path: root/packages/renderers/renderer-vue/client.js
blob: edda137cd8e5a8aa452e20c7a3e72c8bfb087fdd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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);
};