code.js 384 B

12345678910111213141516171819202122232425
  1. const app = new Vue({
  2. el: '#root',
  3. data: {
  4. className: 'royal',
  5. isDisabled: false,
  6. isLoading: false,
  7. title: "Now the title is set through JavaScript",
  8. },
  9. methods: {
  10. onClick(e) {
  11. alert(e.target.textContent);
  12. },
  13. setDisabled() {
  14. this.isDisabled = true;
  15. },
  16. toggleClass() {
  17. this.isLoading = !this.isLoading;
  18. }
  19. },
  20. });