清新UI組件庫——select組件開發思路

清新組件庫:http://ifresh-ui.yating.online/

源碼地址:https://github.com/Chenyating/iFresh-ui
在這裏插入圖片描述

select組件遇到的問題

思路:單選跟多選,就是radio跟checkbox的結合體;

條件判斷,是否可以多選。

z-index

失效的原因:

  1. 父級元素position可能是relative,或者是沒有position;
  2. 元素存在float屬性

解決辦法:

  1. position設置部位relative
  2. 去掉float,清除浮動,浮動元素設置position;
  3. overflow設置爲auto;

tabindex

按tab建的時候順序觸發,可以有blur事件跟focus事件;

展示

  1. 顯示項目(已經選中的框)(框)
  2. 下拉列表項目(已選中項的狀態)

.sync 就是一個語法糖

<parent @click="father()">點擊以後子組件出現</parent>
<children :hehe.sync='ifshow' v-if="ifshow"/>

<!-- children -->
<div @click="children">點擊以後子組件消失</div>
  • 子向父傳參數,通常我都是這麼寫的:
this.$emit('funcName','false')

<children @eventName='funcName'>

funcName(value){
    this.ifshow=value
}
  • 但其實可以這麼寫:
this.$emit('update:Name','false')

<children @update:Name='towho'>

等同於=>@update:Name=function(value){towho=value}

等同於=>@update:Name=value=>towho=value

等同於=>:Name.sync=towho

<children :Name.sync='towho'/>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章