screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html lang="en"> <head> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> </head> <body> <div id="app"> <h3>Vue Js String replaceAll Method</h3> <p>Original String: {{ originalString }}</p> <p>Replaced String: {{ replacedString }}</p> </div> <script type="module"> const app = new Vue({ el: "#app", data() { return { originalString: "The quick brown fox jumps over the lazy dog", searchString: "the", replaceString: "a", }; }, computed: { replacedString() { return this.originalString.replaceAll( new RegExp(this.searchString, "gi"), this.replaceString ); }, }, }) </script> <style scoped> #app { background-color: #f0f0f0; padding: 20px; font-family: Arial, sans-serif; font-size: 16px; color: #333; } #app p { margin-bottom: 10px; } #app p:first-child { font-weight: bold; } </style> </body> </html>