vue+element: 屬性


場景:想動態決定el-input的屬性show-word-limit是否使用

HTML

<script src="//unpkg.com/vue/dist/vue.js"></script>
<script src="//unpkg.com/element-ui@2.8.2/lib/index.js"></script>
<div id="app">
<el-input
  type="text"
  placeholder="請輸入內容"
  v-model="textContent"
  :maxlength="textInputMaxLength"
  :show-word-limit="showWordLimit"
>
</el-input>
<div style="margin: 20px 0;"></div>
<el-input
  type="textarea"
  placeholder="請輸入內容"
  v-model="textareaContent"
  :maxlength="textareaInputMaxLength"
  :show-word-limit="showWordLimit"
>
</el-input>
</div>

 

CSS

@import url("//unpkg.com/element-ui@2.8.2/lib/theme-chalk/index.css");

 

JS

var Main = {
  data() {
    return {
      textContent: '',
      textareaContent: '',      
      textInputMaxLength: 50
      textareaInputMaxLength:100,
      showWordLimit: true
    }
  }
}
var Ctor = Vue.extend(Main)
new Ctor().$mount('#app')

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM