Cristiano Magro
2024-12-27 a3f4566903e67d29e81715324c48ec97e890f1cc
uso di $refs per recuperare un input
2 files modified
6 ■■■■■ changed files
05 - behind the scenes/xno_behind-scenes-01-starting-setup/app.js 4 ●●● patch | view | raw | blame | history
05 - behind the scenes/xno_behind-scenes-01-starting-setup/index.html 2 ●●● patch | view | raw | blame | history
05 - behind the scenes/xno_behind-scenes-01-starting-setup/app.js
@@ -10,7 +10,9 @@
      this.currentUserInput = event.target.value;
    },
    setText() {
      this.message = this.currentUserInput;
      // this.message = this.currentUserInput;
      this.message = this.$refs.userText.value;
      // console.dir(this.$refs.userText)
    },
  },
});
05 - behind the scenes/xno_behind-scenes-01-starting-setup/index.html
@@ -18,7 +18,7 @@
    </header>
    <section id="app">
      <h2>How Vue Works</h2>
      <input type="text" @input="saveInput">
      <input type="text" ref="userText">
      <button @click="setText">Set Text</button>
      <p>{{ message }}</p>
    </section>