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>{{ substring }}</p> </div> <script type="module"> const app = new Vue({ el: "#app", data() { return { originalString: 'Font-Awesome', substring: '' } }, created() { const index = this.originalString.indexOf('-'); this.substring = this.originalString.substring(0, index); } }); </script> <style scoped> #app { font-family: Arial, sans-serif; background-color: #f2f2f2; padding: 20px; } h3 { font-size: 24px; margin-bottom: 10px; } p { font-size: 16px; line-height: 1.5; margin-bottom: 20px; } /* Style the originalString paragraph with a border */ p:nth-of-type(2) { border: 1px solid #ccc; padding: 10px; background-color: #fff; } </style> </body> </html>