【问题标题】:How to disable an input box by clicking a button using vue js 2.0如何通过使用 vue js 2.0 单击按钮来禁用输入框
【发布时间】:2017-06-20 17:33:09
【问题描述】:

如何通过单击按钮并使用 vuejs 2.0 切换来禁用输入框

【问题讨论】:

    标签: vue.js vuejs2 disabled-input vue-directives


    【解决方案1】:

    可以绑定disabled,看例子:

    new Vue({
    
      el: '#app',
      data: {
        isDisabled: false
      }
    
    })
    <script src="https://unpkg.com/vue/dist/vue.js"></script>
    <div id="app">
    
      <input type="text" :disabled="isDisabled">
      <button @click="isDisabled = !isDisabled">Click</button>
    
    </div>

    【讨论】:

      猜你喜欢
      • 2016-08-14
      • 1970-01-01
      • 2013-07-09
      • 2021-03-31
      • 2012-09-25
      • 1970-01-01
      • 2022-01-07
      • 1970-01-01
      • 2017-09-14
      相关资源
      最近更新 更多