JavaScript + Vue

A

by sjclevel

HTML

<div id="app">
  <button @click="changeText">Click me!</button>
  <p>{{ displayText }}</p>
</div>

CSS

body {
  font-family: 'Arial', sans-serif;
  background-color: #e8e8e8;
  padding: 20px;
}

button {
  background-color: #e74c3c;
  color: #ffffff;
  border: none;
  padding: 10px 15px;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

button:hover {
  background-color: #c0392b;
}

p {
  font-size: 18px;
  margin-top: 20px;
}

JavaScript

new Vue({
  el: '#app',
  data: {
    displayText: 'This is the original text.'
  },
  methods: {
    changeText: function() {
      this.displayText = 'This text was changed using the Vue.js Framework! Notice how the structure and data-reactivity system of the framework makes this change possible.';
    }
  }
});