<div id="app">
  <div class="p-5">
    <h4 class="mt-3">沒有延遲</h4>
    {{ withoutLazyMsg }}
    <input type="text" class="form-control" v-model="withoutLazyMsg">
    <h4 class="mt-3">延遲 Lazy</h4>
    {{ lazyMsg }}
    <input type="text" class="form-control" v-model.lazy="lazyMsg">
    <hr>
    <h4 class="mt-3">type=text的 純數值 Number</h4>
    {{ numberMsg1 }} {{ typeof numberMsg1 }}
    <input type="text" class="form-control" v-model.number="numberMsg1">
    <!--  safari就算使用type=number依然可以輸入數字以外的內容...好雷啊~~    -->
    <h4 class="mt-3">限制type=number的 純數值 Number</h4>
    {{ numberMsg2 }} {{ typeof numberMsg2 }}
    <input type="number" class="form-control" v-model="numberMsg2">
    <h4 class="mt-3">修剪 Trim</h4>
    這是一段{{ trimMsg }}緊黏的文字
    <input type="text" class="form-control" v-model.trim="trimMsg">
  </div>
</div>
const App={
  data(){
    return {
      withoutLazyMsg:'',
      lazyMsg:'',
      numberMsg1:'',
      numberMsg2:'0',
      trimMsg:''
    }
  },
  methods:{
  }
}

Vue.createApp(App).mount('#app');
Run Pen

External CSS

  1. https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.2/css/bootstrap.min.css

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/vue/3.2.37/vue.global.prod.min.js