How to bind the acquired data in data by using web speech in vue

problem description

how to bind the acquired data in data using web speech in vue

the environmental background of the problems and what methods you have tried

found the use of web speech in html on the Internet and used it in the project of vue (cli scaffolding). I wanted to send the converted text to the background, but it was a pity that I couldn"t get it

.

related codes

/ / Please paste the code text below (do not replace the code with pictures)

data () {

        return {
            speechContent: "",
            voiceContent: "",
            recognition: "",
        }
    },
       methods: {
        endRecord () {
            console.log(2+this.voiceContent);
            this.$axios.get("http://192.168.0.182:8084/question/test",{
                params: {
                    params :  this.voiceContent
                }
            }).then(
                res => {
                    console.log(res);
                }
            ).catch(
                err => {
                    console.log(err);
                }
            );

            this.recognition.stop();
        }
    },
      created () {
        this.recognition = new webkitSpeechRecognition();
        this.recognition.continuous = true;
        this.recognition.interimResults = true;
        this.recognition.lang = "cmn-Hans-CN"; // ()


        this.recognition.onresult = function(event) {
            let current = event.resultIndex;

            // 
             this.voiceContent = event.results[current][0].transcript;
           
        };
    }

what result do you expect? What is the error message actually seen?

ask the boss who wants to know how to assign the voiceContent in the hook function created to the voiceContent; in data
and ask the boss to see whether my writing is standardized in vue

.
Mar.14,2022

just switch the this.recognition.onresult function to the arrow function.

this.recognition.onresult = (event) => {
                let current = event.resultIndex;

                // 
                this.voiceContent = event.results[current][0].transcript;
                console.log(this.voiceContent);
            };

Hello, where do you use this? Is it the pc end? the compatibility of this web Speech seems to be too good. I need to use it in the phone h5. After testing, many phones do not support it

.
Menu