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 Get Substring before a specific Character</h3> <p>{{ originalString }}</p> <p>{{ firstSubstring }}</p> <p>{{ secondSubstring }}</p> </div> <script type="module"> const app = new Vue({ el: "#app", data() { return { originalString: 'Hello-World-2023', firstSubstring: '', secondSubstring: '' } }, created() { const substrings = this.originalString.split('-'); this.firstSubstring = substrings[0]; this.secondSubstring = substrings[1]; } }); </script> <style scoped> #app { background-color: #f2f2f2; padding: 20px; } h3 { color: #333; font-size: 24px; } p { color: #666; font-size: 18px; margin-bottom: 10px; } </style> </body> </html>