Ref on component

Hi
in version “^4.0.6” i used code such that to get ref value

function getValue(item){
let doc = this.$refs.cmEditor.codemirror.getDoc();
doc.replaceSelection(`{${item}}`);
}

template was :

<codemirror ref="cmEditor" v-model="form.body"  />

today i tried to us it in v.6


function getValue(item:string) {
    **const test =  varBody.value.state.doc()** // why that doesn't work?

     temlates.value.body = `{${item}}`;
     
}

template

<codemirror
      ref="cmEditor"
    v-model="form.body"
 />

why that doesn’t work? why i can’t get ref value?
should u give me advice how is’t working?
task: click on div with some value, this value pass to textarea codemirror. than i can change cursor, click to div and add new val.

I don’t know anything about the web component that you may be using (the library doesn’t provide a <codemirror> tag). But if the .state part works the problem is that you can’t call state.doc because it’s not a function, it’s an object.