PlasmoHQ / with-vue

Plasmo with-vue basic example template
18 stars 0 forks source link

How to use with script setup? #6

Open capoia opened 1 year ago

capoia commented 1 year ago

Hello, first of all thank you very much for the framework, it works incredibly well besides being super simple.

I would like to know if there is any way to use the vue 3 setup script? I tried to adapt (as you can see below), but the styles were not injected.

<script setup lang="ts">
import cssText from "data-text:~/contents/plasmo-overlay.css"
import type { PlasmoCSConfig, PlasmoGetStyle } from "plasmo"

const config: PlasmoCSConfig = {
  matches: ["https://web.whatsapp.com/"]
}

const getStyle: PlasmoGetStyle = () => {
  const style = document.createElement("style")
  style.textContent = cssText
  return style
}

const plasmo = {
  getStyle
}

</script>