Wellington Capoia
Wellington Capoia
Explore posts from servers
PD🧩 Plasmo Developers
Created by Wellington Capoia on 8/6/2024 in #👟framework
different WINDOW variables
I have a script that creates an object that I need to use inside the window variable. I insert this script like this:
const script = document.createElement('script')
script.type = 'text/javascript'
script.src = src
script.async = true
script.onload = () => resolve()
script.onerror = () => reject(new Error(`Failed to load script: ${src}`))
document.head.appendChild(script)
const script = document.createElement('script')
script.type = 'text/javascript'
script.src = src
script.async = true
script.onload = () => resolve()
script.onerror = () => reject(new Error(`Failed to load script: ${src}`))
document.head.appendChild(script)
Then, inside some method or hook of vue I try to use the window.WPP object, but it doesn't exist, but if I type it in the console it does exist. I've already tried using world: MAIN but it still doesn't work!
2 replies
PD🧩 Plasmo Developers
Created by Wellington Capoia on 7/18/2024 in #👟framework
Refused to evaluate a string as JavaScript
Hello, I'm trying to use Vue with the Vuelidate library to validate my inputs, but when I try to validate it gives me the error: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' http://localhost". How would I go about resolving this? If relevant, follow the code:
import { useVuelidate } from '@vuelidate/core'
import { email, required } from '@vuelidate/validators'

const form = reactive({
email: '',
password: '',
loading: false,
})
const rules = computed(() => {
return {
email: { required, email },
password: { required },
}
})
const $v = useVuelidate(rules, form)

async function login() {
$v.value.$validate()
....
}
import { useVuelidate } from '@vuelidate/core'
import { email, required } from '@vuelidate/validators'

const form = reactive({
email: '',
password: '',
loading: false,
})
const rules = computed(() => {
return {
email: { required, email },
password: { required },
}
})
const $v = useVuelidate(rules, form)

async function login() {
$v.value.$validate()
....
}
<template>

<div class="flex flex-col col-span-12">
<label class="mb-2">Email</label>
<InputText v-model="form.email" placeholder="Informe seu email" :class="{
'dark:!border-red-500 dark:!focus:border-red-500 !border-red-500 focus:border-red-500':
$v.email.$error,
}" @change="$v.email.$touch" @keyup.enter="login" />
<small id="text-error" class="mt-2 p-error">{{
$v.email.$errors[0]?.$message || "&nbsp;"
}}</small>
</div>
</template>
<template>

<div class="flex flex-col col-span-12">
<label class="mb-2">Email</label>
<InputText v-model="form.email" placeholder="Informe seu email" :class="{
'dark:!border-red-500 dark:!focus:border-red-500 !border-red-500 focus:border-red-500':
$v.email.$error,
}" @change="$v.email.$touch" @keyup.enter="login" />
<small id="text-error" class="mt-2 p-error">{{
$v.email.$errors[0]?.$message || "&nbsp;"
}}</small>
</div>
</template>
3 replies
PD🧩 Plasmo Developers
Created by Wellington Capoia on 8/29/2023 in #👟framework
XMLHttpRequests
hello, I need to use a library to interact with the google sheet api, and it uses axios that uses XMLHttpRequests, how would I make it work inside the messages in background >messages ?!
2 replies
PD🧩 Plasmo Developers
Created by Wellington Capoia on 8/20/2023 in #👟framework
Watch STORAGE from CSUI or Send message from backgrounds to CSUI
Hello, I have a CSUI with these settings: { matches: ["https://web.whatsapp.com/"], all_frames: true, world: "MAIN", } What I need is that when changing something in the popup my CSUI is warned, I thought of solving this in two ways: watch storage or send messages from the popup/background to the CSUI. The problem is: I can only use the storage inside the backgrounds (message or port) and I couldn't in any way send a message from the backgrounds to the CSUI. Any suggestion?
3 replies
PD🧩 Plasmo Developers
Created by Wellington Capoia on 8/19/2023 in #🔰newbie
Extension runtime is not available
Hi when i try to send a message from a CSUI to a background throws an error "rror: Extension runtime is not available" How do I communicate from a csui with the rest of the application?
3 replies
PD🧩 Plasmo Developers
Created by Wellington Capoia on 8/16/2023 in #👟framework
Extension runtime is not available
Hi when i try to send a message from a CSUI to a background throws an error "rror: Extension runtime is not available" How do I communicate from a csui with the rest of the application?
3 replies
PD🧩 Plasmo Developers
Created by Wellington Capoia on 8/15/2023 in #👟framework
can i send a message from a CSUI directly to popup.ts and vice versa?
Hello, can I send messages directly from CSUI to popup.ts? or do I really need to create the message inside the background folder and then send it to where I want it?!
2 replies
PD🧩 Plasmo Developers
Created by Wellington Capoia on 8/14/2023 in #👟framework
How to use a component library on Contents?
Hello, I would like to use a component package (https://primevue.org/) inside the content folder files. To add to popup/options/newtab etc we have a defineOptions method:
defineOptions({
prepare(app: app) {
app.use(PrimeVue);
app.component("Button", Button)
}
})
defineOptions({
prepare(app: app) {
app.use(PrimeVue);
app.component("Button", Button)
}
})
Where can I setup primevue correctly. But within the files of the Content folder this does not work, I use the same code but the components do not appear. Would you have any practical examples of how to use the component library within the contents?
22 replies