slidevjs / slidev

Presentation Slides for Developers
https://sli.dev
MIT License
33.49k stars 1.37k forks source link

Web Components #254

Closed deleonio closed 3 years ago

deleonio commented 3 years ago

How we can use web components in slices?

https://github.com/slidevjs/slidev/issues/233

image

deleonio commented 3 years ago

https://www.digitalocean.com/community/tutorials/vuejs-vue-integrate-web-components

deleonio commented 3 years ago
const app = Vue.createApp({})
app.config.isCustomElement = tag => tag === 'plastic-button'
deleonio commented 3 years ago

image

I tried

// ./setup/main.ts
import { defineAppSetup } from '@slidev/types';

export default defineAppSetup(({ app }) => {
  console.log(app);
  app.config.isCustomElement = (tag) => {
    console.log('isCustomElement', tag);
    return tag === 'kol-counter';
  };
});

export default { plugins: [ vue({ template: { compilerOptions: { isCustomElement: (tag) => { console.log('isCustomElement', tag); return tag === 'kol-counter'; }, }, }, }), ], };

deleonio commented 3 years ago

It works

image

But unfortunately I can't get rid of the console error.