-
ProblemI want to use primevue with plasmo. AS-IS // @ts-nocheck
import * as Component from "../../popup.vue"
import { createApp } from "vue"
document.addEventListener("DOMContentLoaded", () => {
const app = createApp(Component.default)
app.mount("#root")
}) TO-BE // @ts-nocheck
import * as Component from "../../popup.vue"
import { createApp } from "vue"
import PrimeVue from 'primevue/config'; #ADD
document.addEventListener("DOMContentLoaded", () => {
const app = createApp(Component.default)
app.mount("#root")
app.use(PrimeVue) #ADD
}) Please somebody tell me how to override Settings
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
@yasaidev just updated vue to support plugin via a prepare option, refer to this for example: https://github.com/PlasmoHQ/examples/blob/main/with-vue/popup.vue You will need to upgrade to plasmo v0.72.1 as well as latest vue for this feature. |
Beta Was this translation helpful? Give feedback.
-
Thank you. I checked this code and tested, but unfortunately I got error like below. Uncaught ReferenceError: defineOptions is not defined
at setup (popup.vue:55:15)
at callWithErrorHandling (runtime-core.esm-bundler.js:159:17)
at setupStatefulComponent (runtime-core.esm-bundler.js:7240:52)
at setupComponent (runtime-core.esm-bundler.js:7198:32)
at mountComponent (runtime-core.esm-bundler.js:5601:9)
at processComponent (runtime-core.esm-bundler.js:5576:7)
at patch (runtime-core.esm-bundler.js:5051:32)
at render (runtime-core.esm-bundler.js:6334:5)
at mount (runtime-core.esm-bundler.js:3826:11)
at app.mount (runtime-dom.esm-bundler.js:1432:9) EnvironmentInfo$ node -v
v18.16.0
$ npm -v
8.5.5
$ systeminfo
OS Name: Microsoft Windows 11 Education
OS Version: 10.0.22621 N/A Build 22621 How to testnpm create plasmo -- --with-vue
npm install
npm run dev |
Beta Was this translation helpful? Give feedback.
-
I also found a quick way to use vue plugin with plasmo. <script setup lang="ts">
+import { reactive, getCurrentInstance } from "vue"
import type { App } from "vue"
const state = reactive({ count: 0, action: null })
+const vueInstance = getCurrentInstance()
+vueInstance ?.appContext.app.use()
function increment() {
state.count++
state.action = "increment"
}
function decrement() {
state.count--
state.action = "decrement"
}
-defineOptions({
- prepare(app: App) {
- // Use any plugins here:
- // app.use
- }
-})
</script> To use Anyway this way is worked for me. |
Beta Was this translation helpful? Give feedback.
@yasaidev just updated vue to support plugin via a prepare option, refer to this for example: https://github.com/PlasmoHQ/examples/blob/main/with-vue/popup.vue
You will need to upgrade to plasmo v0.72.1 as well as latest vue for this feature.