Question 27
Consider the following Vue application with markup “index.html” and javascript file “app.js”.
index.html:
<div id = "app"> <input v-model = "text" @input = "save_data"> <p> {{content}} </p></div><script scr = "app.js"></script>app.js:
new Vue({ el : "#app", data : { text : "", content : "", },
mounted () { try {
this.text = localStorage.getItem("value1").split("abhi").slice(1,-1),join(""); this.content =localStorage.getItem("value1").split("abhi").slice(1),join(""); } catch { this.text = ""; this.content = ""; } },
methods : { save_data() { localStorage.setItem("value1", this.text); localStorage.setItem("value2", this.content); } }})Suppose you open “index.html” file in a browser, and type the text “abhishekabhinavabhi” in the text box shown (after removing the previous text, if any), and hard refresh the page twice, without clicking anywhere. What will be the value shown in the text box, and the “age” placeholder, respectively?