Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vue 3 support #1

Open
albericobenhur opened this issue Sep 6, 2022 · 14 comments
Open

Vue 3 support #1

albericobenhur opened this issue Sep 6, 2022 · 14 comments

Comments

@albericobenhur
Copy link

i would like to know if there will be support for vue 3

@YasCoMa
Copy link

YasCoMa commented Feb 19, 2023

This is an important update for new updates of Vue and Nuxt. Please, provide this support as soon as possible.

@hermesalvesbr
Copy link

Bom dia, conversei com @ktquez , o proprietário do repositório e ele falou que vai atualizar em breve

@ktquez ktquez changed the title Vue 3 suport Vue 3 support Mar 17, 2023
@ktquez
Copy link
Member

ktquez commented Mar 17, 2023

Pessoal, demorou, estou afastado um pouco da área, então a manutenção do projeto está um pouco lenta.
Em breve voltaremos com tudo e atualizando tudo para Vue 3

Dei uma adaptada, gostaria que vocês pudessem dar uma testada e passar um feedback se está funcionando nos mais variados usos de vocês.

Adicionei uma tag "@vue-a11y/vlibras@next" ao pacote, assim que testado e ok, a gente o transforma na versão principal do componente, blz

Aqui está o link da branch: https://github.com/vue-a11y/vue-vlibras/tree/next

Qualquer coisa, só mandar por aqui.

Valeuu

@albericobenhur
Copy link
Author

ktquez funcionou muito bem, muitíssimo obrigado 😁😁😁😁

@albericobenhur
Copy link
Author

albericobenhur commented Apr 22, 2023

@ktquez , Bom dia Alan Ktquez, ele funcionou perfeitamente no vue 3, tem alguma forma dele funcionar com nuxt 3 também? eu tentei aqui mas não consegui

image

quando tento usar no client side ele não emite erros mas também não renderiza

@ktquez
Copy link
Member

ktquez commented Apr 22, 2023

@albericobenhur Interessante. Vou dar uma testada para ver o que pode ser, blz

@hermesalvesbr
Copy link

Será que a abordagem deve ser via ref?

https://koenwoortman.com/vuejs-get-element-by-id-in-component/

@hermesalvesbr
Copy link

Aqui não funciona ainda, funcionou com mais alguém?

@albericobenhur
Copy link
Author

Vou continuar tentando. Mas no meu também ainda não funcionou

@YasCoMa
Copy link

YasCoMa commented Jun 30, 2023

Hey I would like to share the solution in my project, in nuxt v3.
I mixed the integration in the .vue file of this repository and the original documentation for vlibras: https://vlibras.gov.br/doc/widget/installation/webpageintegration.html?_ga=2.205222480.1595640842.1682445746-816840059.1655413110

The original vlibras-plugin.js has a typo error, there is a ghost character in if(initializing). Firstly, i fixed it and put it in public/js/
So i changed the variable src to point to my version of the plugin. The urlWidget can be kept the same value.

I changed the init() method and added the following attributes for script:

script.id = 'vlbr';
script.async = true;

I inserted the methods init and createWidget directly in App.vue, for nuxt.
and i called this.init() in mounted()

in the final part of the template html i added:

<ClientOnly>
        <div v-if="mounted">
            <div vw class="enabled">
                <div vw-access-button class="active"></div>
                <div vw-plugin-wrapper>
                    <div class="vw-plugin-top-wrapper"></div>
                </div>
            </div>
        </div>        
        </ClientOnly>

I hope this explanation help you all.

@ktquez
Copy link
Member

ktquez commented Jun 30, 2023

Obrigado @YasCoMa
Espero que ajude o pessoal a utilizar essa solução para imediato

Eu ainda estou afastado da área por motivos pessoais e por isso não estou conseguindo ajudar a dar suporte imediatamente.
Irei voltar no segundo semestre e caso alguém não tenha feito algum PR para essa correção, irei solucionar isso internamente no vue-vlibras

@hermesalvesbr
Copy link

initializing

@YasCoMa obrigado pelo apoio, ainda estou na luta para integrar com Nuxt 3.

Coloquei o vlibras-plugin.js em:
https://gist.github.com/hermesalvesbr/fd59edc24bdbd3403630417067b12391

Seria possível me apontar em qual linha eu devo colocar os atributos:

script.id = 'vlbr';
script.async = true;

Ou compartilhar no gist o seu vlibras-plugin.js? Fico grato com a atenção dedicada.

@hermesalvesbr
Copy link

and i called this.init() in mounted()

Eu estou tentando(também) uma nova abordagem:

<template>
    <ClientOnly>
        <div class="enabled">
            <div ref="accessButton" class="active"></div>
            <div ref="pluginWrapper">
                <div class="vw-plugin-top-wrapper"></div>
            </div>
        </div>
    </ClientOnly>
</template>

<script setup lang="ts">
const accessButton = ref(null)
const pluginWrapper = ref(null)

const initVLibras = () => {
    const script = document.createElement('script')
    script.src = 'https://vlibras.gov.br/app/vlibras-plugin.js'
    script.async = true
    script.onload = createWidget
    document.body.appendChild(script)
}

const createWidget = () => {
    new window.VLibras.Widget('https://vlibras.gov.br/app')
}

onMounted(() => {
    initVLibras()
})
</script>

Também não funciona.

:(

@YasCoMa
Copy link

YasCoMa commented Aug 25, 2023

I added these new attributes in as a complement to this function:

methods: {
init () {
script = document.createElement('script')
script.addEventListener('load', this.createWidget)
script.src = this.src
document.querySelector('body').appendChild(script)
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants