Skip to content
This repository was archived by the owner on Jun 18, 2025. It is now read-only.
This repository was archived by the owner on Jun 18, 2025. It is now read-only.

Vue3 + TypeScript #547

@reyesmfabian

Description

@reyesmfabian

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions