国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

el-select范圍選擇框

這篇具有很好參考價(jià)值的文章主要介紹了el-select范圍選擇框。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問(wèn)。

1、html

<el-select
v-model="searchForm.hour"
:class="searchForm.hour?.length>1?'edit-tag-hour':'keep-tag-hour'"
filterable
multiple
clearable
:multiple-limit="2"
@remove-tag="removeChange"
@change="hourChange"
>
<el-option v-for="item in hourList" :key="item.value" class="ad-hour-bg" :label="item.label" :value="item.value" @mouseover.native="handleMouseOver(index)" />
</el-select>

2、js

    handleMouseOver(index) {
      if (this.searchForm.hour?.length === 1) {
        const arrIndex = [this.searchForm.hour[0], index].sort((x, y) => x - y)
        const elements = document.querySelectorAll('.ad-hour-bg')
        elements.forEach((element, index) => {
          if (index > arrIndex[0] && index < arrIndex[1]) {
            element.style.backgroundColor = '#F2F6FC'
            element.style.color = '#C0C4CC'
          } else if (index === arrIndex[1]) {
            element.style.backgroundColor = '#1177ff'
            element.style.color = '#FFF'
          } else if (index !== arrIndex[0]) {
            element.style.backgroundColor = ''
            element.style.color = '#606266'
          }
        })
      }
    },   
 removeChange(value) {
      if (this.searchForm.hour?.length > 0) {
        const elements = document.querySelectorAll('.ad-hour-bg')
        elements.forEach((element, index) => {
          if (index === this.searchForm.hour[0]) {
            element.style.backgroundColor = '#FFF'
            element.style.color = '#606266'
          }
        })
        this.searchForm.hour = null
      }
    },
    hourChange(value) {
      const elements = document.querySelectorAll('.ad-hour-bg')
      if (value?.length > 1) {
        value.sort((x, y) => x - y)
        this.$nextTick(() => {
          const parentElement = document.querySelector('.edit-tag-hour')
          if (parentElement) {
            const bbElements = parentElement.querySelectorAll('.el-select__tags-text')
            if (bbElements.length > 0) {
              const firstBbElement = bbElements[0]
              firstBbElement.textContent = `${firstBbElement.textContent} - `
            }
          }
        })
        elements.forEach((element, index) => {
          if (index > value[0] && index < value[1]) {
            element.style.backgroundColor = '#F2F6FC'
          } else if (index === value[0] || index === value[1]) {
            element.style.backgroundColor = '#1177ff'
            element.style.color = '#FFF'
          } else {
            element.style.color = '#C0C4CC'
          }
        })
      } else {
        elements.forEach((element, index) => {
          if (index === value[0]) {
            element.style.backgroundColor = '#1177ff'
            element.style.color = '#FFF'
          } else {
            element.style.backgroundColor = ''
            element.style.color = '#606266'
          }
        })
        this.$nextTick(() => {
          const parentElement = document.querySelector('.keep-tag-hour')
          if (parentElement) {
            const bbElements = parentElement.querySelectorAll('.el-select__tags-text')
            const firstBbElement = bbElements[0]
            firstBbElement.textContent = firstBbElement.textContent.replace('-', '')
          }
        })
      }
    },

3、?css

  .edit-tag-hour {
    .el-tag:nth-child(1) {
      border-right: 0;
      border-radius: 4px 0 0 4px;
      padding-right: 0;
      .el-tag__close {
        display: none;
      }
    }
    .el-tag:nth-child(2) {
      margin-left: 0;
      border-left: 0;
      border-radius: 0 4px 4px 0;
    }
  }

效果圖?

el-select范圍選擇框,vue.js,javascript,前端

僅供參考,具體的實(shí)現(xiàn)可能根據(jù)自己的需要修改?,僅供參考!僅供參考!僅供參考!文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-681808.html

到了這里,關(guān)于el-select范圍選擇框的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來(lái)自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • element el-select下拉框選擇失效

    element el-select下拉框選擇失效

    2023.1.11今天我學(xué)習(xí)了使用element el-select組件下拉框選擇數(shù)據(jù)失效的原因以及解決辦法。 如圖: ? 當(dāng)我已經(jīng)選擇啟用狀態(tài)的時(shí)候,然后點(diǎn)擊停用狀態(tài)沒(méi)反應(yīng)。 是因?yàn)樵谂渲帽韱蔚倪^(guò)程中,重復(fù)使用了這個(gè)字段。 如: 就是在表單中重復(fù)使用了status這個(gè)字段,然后導(dǎo)致選擇失效。

    2024年02月16日
    瀏覽(30)
  • vue2 - 詳細(xì)介紹element UI中在el-select嵌套el-tree樹形控件實(shí)現(xiàn)下拉選擇樹型結(jié)構(gòu)數(shù)據(jù)的效果實(shí)例(組件封裝)

    vue2 - 詳細(xì)介紹element UI中在el-select嵌套el-tree樹形控件實(shí)現(xiàn)下拉選擇樹型結(jié)構(gòu)數(shù)據(jù)的效果實(shí)例(組件封裝)

    在項(xiàng)目上常用使用到?el-select?和?el-tree?組合實(shí)現(xiàn),記錄下兩者結(jié)合的實(shí)現(xiàn)過(guò)程。(代碼以及注釋清晰明了,代碼直接使用即可) 要求根據(jù)項(xiàng)目接口提供的數(shù)據(jù),el-tree 里的數(shù)據(jù)是一次性返回來(lái)的,點(diǎn)擊最后一層級(jí)時(shí),請(qǐng)求接口,在點(diǎn)擊層級(jí)下方追加數(shù)據(jù)追加的數(shù)據(jù)要顯示勾

    2024年04月15日
    瀏覽(90)
  • VUE element-ui 使用Screefull 頁(yè)面全屏?xí)rel-select下拉菜單不顯示(下拉框不顯示無(wú)法選擇)問(wèn)題解決

    VUE element-ui 使用Screefull 頁(yè)面全屏?xí)rel-select下拉菜單不顯示(下拉框不顯示無(wú)法選擇)問(wèn)題解決

    問(wèn)題原因:elemrnt-ui會(huì)默認(rèn)將彈出框插入至 body 元素;當(dāng)設(shè)置了某個(gè)元素全屏?xí)r,會(huì)遮擋住原來(lái)的select下拉數(shù)據(jù)。

    2024年02月14日
    瀏覽(99)
  • elementUI --- el-select 下拉框 日歷 級(jí)聯(lián)選擇

    elementUI --- el-select 下拉框 日歷 級(jí)聯(lián)選擇

    element UI 組件庫(kù)中的 select 選擇器 中下拉列表的樣式,在頁(yè)面渲染的時(shí)候,總是渲染為僅次于body級(jí)別的div ,這樣子覆蓋樣子會(huì)影響全局其他的select選擇器下拉框樣式,試圖通過(guò)給el-select加父標(biāo)簽來(lái)覆蓋,然而并沒(méi)有卵用。 控制臺(tái)看到的渲染結(jié)果: 解決方法: 通過(guò) popper-cla

    2024年02月15日
    瀏覽(27)
  • 【elementUI】el-select選擇框位置錯(cuò)位、偏移bug

    在el-select組件中,可能會(huì)由于option選項(xiàng)過(guò)多而導(dǎo)致下拉框位置錯(cuò)亂、偏移的情況,我個(gè)人試驗(yàn)大概是在5-6個(gè)option以上時(shí),該bug就會(huì)出現(xiàn)。 這個(gè)時(shí)候需要手動(dòng)為下拉框設(shè)置: popper-append-to-body=\\\"false\\\" 屬性,并設(shè)置以下CSS樣式解決問(wèn)題:

    2024年02月15日
    瀏覽(27)
  • el-select與el-tree結(jié)合使用,實(shí)現(xiàn)select框下拉使用樹形結(jié)構(gòu)選擇數(shù)據(jù)

    el-select與el-tree結(jié)合使用,實(shí)現(xiàn)select框下拉使用樹形結(jié)構(gòu)選擇數(shù)據(jù)

    使用el-select與el-tree,實(shí)現(xiàn)如下效果, 代碼如下: ?注意點(diǎn):搜索input框的代碼一點(diǎn)放在option上面,不要放在option里面,否則一點(diǎn)擊搜索框,下拉框就會(huì)收起來(lái),不能使用。

    2024年02月13日
    瀏覽(29)
  • el-select數(shù)據(jù)過(guò)多的解決(純前端)

    el-select數(shù)據(jù)過(guò)多的解決(純前端)

    el-select數(shù)據(jù)過(guò)多這個(gè)問(wèn)題應(yīng)該很多人都遇到過(guò),在生產(chǎn)環(huán)境中數(shù)據(jù)幾百、幾千條是比較常見的。當(dāng)數(shù)據(jù)過(guò)多時(shí),就會(huì)造成瀏覽器卡頓,如果客戶電腦性能不行,瀏覽器直接卡死也有可能。 先說(shuō)一下現(xiàn)在項(xiàng)目中遇到的兩種解決方案: 添加分頁(yè)條 這種方案好像有點(diǎn)問(wèn)題,具體什

    2024年02月09日
    瀏覽(15)
  • el-select報(bào)錯(cuò):vue.esm.js?5cd5:5105 [Vue warn]: <transition-group> children must be keyed: <ElTag>;無(wú)法選中

    el-select報(bào)錯(cuò):vue.esm.js?5cd5:5105 [Vue warn]: <transition-group> children must be keyed: <ElTag>;無(wú)法選中

    目錄 一、問(wèn)題 二、原因及解決方法 三、總結(jié) Tips:嫌麻煩可以直接看總結(jié)中有顏色的字體即可! 1. 使用element select控件時(shí)有警告(transition-group children must be keyed: ElTag)且無(wú)法選中下拉項(xiàng) vue.esm.js?5cd5:5105 [Vue warn]: transition-group children must be keyed: ElTag found in --- TransitionGroup ? ? ? ?

    2024年02月14日
    瀏覽(19)
  • vue el-select默認(rèn)值

    情景:在調(diào)取接口后渲染數(shù)據(jù)時(shí)需要將選取的select設(shè)為默認(rèn)值,具體案例為調(diào)取省份數(shù)據(jù)后,根據(jù)省份獲取其對(duì)應(yīng)的城市數(shù)據(jù),并將其對(duì)應(yīng)的el-select默認(rèn)選中該數(shù)據(jù)的狀態(tài) 問(wèn)題:看到網(wǎng)上很多說(shuō)直接改el-select綁定的v-model的值,這樣做就會(huì)掉入select框中僅僅是顯示相應(yīng)的文字

    2024年02月13日
    瀏覽(22)
  • 解決element-ui中的el-select選擇器無(wú)法顯示選中內(nèi)容的問(wèn)題

    解決element-ui中的el-select選擇器無(wú)法顯示選中內(nèi)容的問(wèn)題

    問(wèn)題描述: 排查方法: 檢查數(shù)據(jù)控制臺(tái)是否報(bào)錯(cuò),無(wú)報(bào)錯(cuò) 檢查change是否觸發(fā),會(huì)觸發(fā) 最后開始百度,查看文檔? 官方文檔有這么一段話,就是屬性一定要掛載到data上,不然無(wú)法檢測(cè)。 最后解決: 排查到我的form表單,在定義表單屬性的時(shí)候,沒(méi)有在data中定義該字段。 總結(jié)

    2024年01月23日
    瀏覽(25)

覺(jué)得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包