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

Vue3 + TypeScript #547

Open
reyesmfabian opened this issue Feb 14, 2022 · 0 comments
Open

Vue3 + TypeScript #547

reyesmfabian opened this issue Feb 14, 2022 · 0 comments

Comments

@reyesmfabian
Copy link

reyesmfabian commented Feb 14, 2022

Hi, I have an application with socket.io implementation with vue-socket.io-extended library.

Now. In Vue2 i have a file mixins.js with the mixins of my app. And I can access the properties of the socket like this.$socket.client.id

Something like this:

// Mixins.js file

export const myMixins ={
methods:{
async update() {
......
      const idSocket = this.$socket.client.id;
.........
    },
}
}

Now in Vue3 with typescript, I have the file Mixins.ts

// Mixins.ts file


const myMixins = () => {

const  update = async ()  => {
......
      const idSocket = this.$socket.client.id; -> the Vue instance is not recognized with "this".
.........
    }

return {update}

}

export default myMixins;

What is the closest approximation to be able to do the same process in Vue3 with TypeScript and Composables?

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

1 participant