screen_rotation
Copied to Clipboard
<html> <head> <meta charset="UTF-8"> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> </head> <body> <div id="app"> <h3>Vue js string replace only numbers with space</h3> <input type="text" v-model="myString"> <button @click="replaceNumbersWithSpaces">Replace</button> <small>{{ myString }}</small> </div> <script type="module"> const app = new Vue({ el: "#app", data() { return { myString: 'hello123world' } }, methods: { replaceNumbersWithSpaces() { this.myString = this.myString.replace(/\d+/g, ' '); } }, }); </script> <style scoped> #app { margin: 20px; padding: 10px; border: 1px solid black; font-family: Arial, sans-serif; font-size: 16px; } h3 { font-size: 24px; margin-bottom: 10px; } input[type="text"] { padding: 5px; border: 1px solid gray; border-radius: 5px; margin-right: 10px; font-size: 16px; } button { padding: 5px 10px; border-radius: 5px; border: none; background-color: #4CAF50; color: white; cursor: pointer; font-size: 16px; } button:hover { background-color: #357a38; } small { display: block; margin-top: 10px; } </style> </body> </html>