screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script> </head> <body> <div id="app"> <h3>Vue Js Convert String into Camel Case </h3> <p>String: {{str}} </p> <p >Camel Case String: {{ toCamelCase}}</p> </div> <script type="module"> const app = Vue.createApp({ data() { return { str: 'my camel case string' } }, computed: { toCamelCase() { return this.str.replace(/(?:^\w|[A-Z]|\b\w)/g, function (word, index) { return index === 0 ? word.toLowerCase() : word.toUpperCase(); }).replace(/\s+/g, ''); } } }); app.mount('#app'); </script> </body> </html>