Skip to content

How can we use data and methods in vue-worker ? #28

Description

@hamelraj89

I have read this

It is not possible to pass as an arg this from a Vue Component. You can pass this.$data or any variable within data or computed

but no idea how to access data and methods insight worker ?

 export default {
        components: {
            Attribute,
            vueCustomScrollbar,
            Time
        },
        data() {
            return {
              user : {},
            }
        },
       computed:{
           reversedMessage: function () {
              return 100000;
            }
       },
       mounted() {
       // how to use vue worker to access 
           this.$worker.run(this.userDetails()); // not working
           this.$worker.run((arg1) => `this.$worker run 2: ${arg1}`, [this.$reversedMessage]). // not working
          this.$worker.run((arg1) => `this.$worker run 2: ${arg1}`, [this.$data.user]). // working
       },
        methods: {
          userDetails(){
          }
        }
}

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