screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <script src="https://unpkg.com/vue@3.2.22/dist/vue.global.js"></script> </head> <body> <div id="app"> <h3>Vue Js Remove White Space from End of String</h3> <pre>{{ text }}</pre> <small>Text Length: {{text.length}}</small> <button @click="removeWhiteSpace">Remove White Space</button> <pre v-if="result">{{result}}</pre> <small v-if="result">Text Length after Remove White Space end of string: {{result.length}}</small> </div> <script type="module"> const app = Vue.createApp({ data() { return { text: 'Some text with white space at the end ', result: '' }; }, methods: { removeWhiteSpace() { this.result = this.text.trimEnd(); } } }); app.mount('#app'); </script> <style scoped> #app { max-width: 600px; margin: 0 auto; padding: 20px; background-color: #f5f5f5; border: 1px solid #ddd; } h3 { font-size: 24px; font-weight: bold; margin-bottom: 10px; } pre { white-space: pre-wrap; font-size: 16px; line-height: 1.5; margin: 0; } small { display: block; margin-top: 10px; font-size: 14px; } button { background-color: #4caf50; color: #fff; border: none; border-radius: 4px; font-size: 16px; padding: 10px 20px; margin-top: 10px; cursor: pointer; } pre.result { background-color: #fff; margin-top: 10px; border: 1px solid #ddd; padding: 10px; } </style> </body> </html>