Advertisement
tomuwhu

Vue 1 példa

Jan 27th, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <template>
  2.   <div id="app">
  3.     <input v-model="x" @keyup.enter="f()">
  4.     <br>
  5.     <li v-for="(elem,i) in t" v-html="elem" :key="i"/>
  6.   </div>
  7. </template>
  8.  
  9. <script>
  10. export default {
  11.   name: "App",
  12.   data() {
  13.     return {
  14.       x: 1,
  15.       t: []
  16.     };
  17.   },
  18.   methods: {
  19.     f() {
  20.       this.t.push(this.x);
  21.       this.t.sort((a, b) => a.localeCompare(b));
  22.       this.x = "";
  23.     }
  24.   }
  25. };
  26. </script>
  27.  
  28. <style>
  29. #app {
  30.   font-size: 20px;
  31. }
  32. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement