Closed Elyes5 closed 1 year ago
@Elyes5 Good question, I just updated the package, you can update it and use it like this:
I added a new event lang
, it can pass the current language through the parameter;
Step 1, Binding a function to the event lang
<CodeEditor
@lang="getLanguage"
></CodeEditor>
Step 2, Using the function you have bound to get the current language
methods: {
getLanguage(lang){
console.log('The current language is: ' + lang)
}
},
one other question what if you had to save the selected language , could you create an event called selected language to do that? I think that would help each and every user of the component . By default , as far as I saw when I used the component, the value of the dropdown menu of the language would always be the first element. Is it possible to pass the language you want to select in props? And by the way thanks you! this component is extremely helpful.
@Elyes5 Thanks for your support, the new event langs
can pass the language list (a two-dimensional array) after mounted, you can update the package and try it like the lang
, and your second question maybe can refer to this issue: https://github.com/justcaliturner/simple-code-editor/issues/9#issuecomment-1094275118
I'd like to get the value of the language that I selected ( without having to use vanillaJS because I'm having VDOM and I don't want to interact with the dom directly ) . The code-editor doesn't offer an attribute to get the selected value of the programming language. Is there a way to do that?