最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

avue實(shí)現(xiàn)自定義搜索欄及清空搜索事件的實(shí)踐

 更新時(shí)間:2021年12月12日 11:33:15   作者:指標(biāo)滿載  
本文主要介紹了avue實(shí)現(xiàn)自定義搜索欄及清空搜索事件的實(shí)踐,主要包括對搜索欄進(jìn)行自定義,并通過按鈕實(shí)現(xiàn)折疊搜索欄效果,具有一定的參考價(jià)值,感興趣的可以了解一下

對搜索欄進(jìn)行自定義,并通過按鈕實(shí)現(xiàn)折疊搜索欄效果。自定義效果如下:

折疊前:

在這里插入圖片描述

折疊后:

在這里插入圖片描述

1、自定義搜索欄內(nèi)容

其實(shí)也簡單,只要在對應(yīng)的vue文件中\(zhòng)src\views\admin\sysxxfsjl.vue對template 設(shè)置slot-scope="scope"和 slot="search"屬性即可自定義搜索欄內(nèi)容:

<template slot-scope="scope" slot="search">
                  <el-form ref="form" :model="searchForm" style="width: 830px;margin-left: -10px; display: inline-block;" label-width="100px">
                    <el-row>
                      <el-form-item label="主題:">
                        <el-input v-model="searchForm.xxbt" style="width: 238px;margin-left: -100px" @change="getList()"></el-input>
                      </el-form-item>
                      <el-form-item label="發(fā)送人:">
                        <el-cascader
                          v-model="fsrid"
                          :options="options"
                          clearable
                          style="width: 242px !important;margin-left: -100px"
                          :props="{ expandTrigger: 'hover' }"
                          @change="getList()"></el-cascader>
                      </el-form-item>
                    </el-row>
                    <el-row v-show="moreshow">
                      <el-form-item label="發(fā)送時(shí)間:">
                        <el-date-picker
                          style="width: 238px !important; margin-left: -100px"
                          v-model="timeSlot"
                          type="daterange"
                          align="right"
                          unlink-panels
                          format="yyyy-MM-dd HH:mm:ss"
                          value-format="yyyy-MM-dd HH:mm:ss"
                          range-separator="至"
                          start-placeholder="開始日期"
                          end-placeholder="結(jié)束日期"
                          :picker-options="pickerOptions"
                          @change="getList()">
                        </el-date-picker>
                      </el-form-item>
                      <el-form-item label="方式:" >
                        <el-radio-group v-model="searchForm.fsfs" size="small" style="margin-left: -100px" @change="getList()">
                          <el-radio-button label="4">系統(tǒng)消息</el-radio-button>
                          <el-radio-button label="1">手機(jī)短信</el-radio-button>
                          <el-radio-button label="3">微信發(fā)送</el-radio-button>
                        </el-radio-group>
                      </el-form-item>
                    </el-row>
                    <el-row v-show="moreshow">
                      <el-form-item label="閱讀狀態(tài):">
                        <el-radio-group v-model="sfyd" size="small" style="margin-left: -100px;width: 238px" @change="getList()">
                          <el-radio-button label="2">所有</el-radio-button>
                          <el-radio-button label="1">已讀</el-radio-button>
                          <el-radio-button label="0">未讀</el-radio-button>
                        </el-radio-group>
                      </el-form-item>
                      <el-form-item label="是否轉(zhuǎn)待辦:">
                        <el-radio-group v-model="checkList" style="margin-left: -100px" @change="getList()">
                          <el-radio-button label="1">是</el-radio-button>
                          <el-radio-button label="0">否</el-radio-button>
                        </el-radio-group>
                      </el-form-item>
                    </el-row>
                  </el-form>
                </template>

搜索按鈕 調(diào)用的是getList中的方法,給表格賦值數(shù)據(jù)

getList(page, params) {
              this.tableData=[]
                if (this.timeSlot && this.timeSlot.length == 2) {//發(fā)送時(shí)間
                  this.searchForm.startTime = this.timeSlot[0].replace(/\+/g, ' ')
                  this.searchForm.endTime = this.timeSlot[1].replace(/\+/g, ' ')
                }else {
                  delete this.searchForm.startTime
                  delete this.searchForm.endTime
                }
                if (this.fsrid.length){//發(fā)送人
                  this.searchForm.fsrid = this.fsrid[this.fsrid.length-1]
                }else {
                  delete this.searchForm.fsrid
                }
                if (this.sfyd.length>0){//是否轉(zhuǎn)待辦
                  if (this.sfyd== 1){
                    this.searchForm.sfyd = 1
                  }else if (this.sfyd== 0){
                    this.searchForm.sfyd = 0
                  }else {
                    delete this.searchForm.sfyd
                  }
                }else {
                  delete this.searchForm.sfyd
                }
                if (this.checkList!=''){//是否轉(zhuǎn)待辦
                  if (this.checkList== '1'){
                    this.searchForm.sfdb = 1
                  }else {
                    this.searchForm.sfdb = 0
                  }
                }else {
                  delete this.searchForm.sfdb
                }
                if (!page) {
                  page = this.page
                }
                this.tableLoading = true
                fetchList(Object.assign({
                    current: page.currentPage,
                    size: page.pageSize
                }, params, this.searchForm )).then(response => {
                  for(var i=0;i<response.data.data.records.length;i++){
                    response.data.data.records[i].checkbox=[]
                    if(response.data.data.records[i].sfyd==0){
                      response.data.data.records[i].checkbox.push(' 未讀')
                    }else{
                      response.data.data.records[i].checkbox.push(' 已讀')
                    }
                    if(response.data.data.records[i].sfdb==1){
                      response.data.data.records[i].checkbox.push(' 待辦')
                    }
                    if(response.data.data.records[i].sfsc==1){
                      response.data.data.records[i].checkbox.push(' 收藏')
                    }
                    if(response.data.data.records[i].sfhf==1){
                      response.data.data.records[i].checkbox.push(' 已回')
                    }
                    if(response.data.data.records[i].xxfjmc){
                      response.data.data.records[i].xxfjmc=response.data.data.records[i].xxfjmc.split(',')
                    }else{
                      response.data.data.records[i].xxfjmc=[]
                    }
                    this.tableData.push(response.data.data.records[i])
                  }
                    this.page.total = response.data.data.total
                    this.tableLoading = false
                }).catch(() => {
                    this.tableLoading=false
                })
            },

2、自定義搜索按鈕

template 設(shè)置slot-scope="scope"和 slot="searchMenu"屬性即可自定義搜索按鈕,加上更多按鈕:

<template slot-scope="scope" slot="searchMenu">
                  <el-button v-if="moreshow" type="success" class="el-button--small" icon="el-icon-caret-top" @click="getmoreshow(1)">隱藏</el-button>
                  <el-button v-else class="el-button--small" icon="el-icon-caret-bottom" @click="getmoreshow(2)">更多</el-button>
                </template>

更多、隱藏按鈕調(diào)用方法對搜索項(xiàng)進(jìn)行顯隱

getmoreshow(type){
            if(type==1){
              this.moreshow=false
            }else{
              this.moreshow=true
            }
          },

清空按鈕 需在avue-crud上增加@search-reset事件。進(jìn)行清空選項(xiàng)內(nèi)容并調(diào)用this.getList(this.page);

在這里插入圖片描述

//搜索清空按鈕事件
            searchReset(){
              this.searchForm = {}
              this.searchForm.sfyd = ''
              if (this.searchForm.sfyd!=''){//是否轉(zhuǎn)待辦
                if (this.searchForm.sfyd== '1'){
                  this.searchForm.sfyd = 1
                }else {
                  this.searchForm.sfyd = 0
                }
              }else {
                delete this.searchForm.sfyd
              }
              this.fsrid = []
              this.timeSlot = []
              this.checkList = ''
              this.sfyd = ''
              this.$refs.crud.toggleSelection();
              this.getList(this.page);
            },

到此這篇關(guān)于avue實(shí)現(xiàn)自定義搜索欄及清空搜索事件的實(shí)踐的文章就介紹到這了,更多相關(guān)avue 自定義搜索欄及清空搜索內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • vue3實(shí)現(xiàn)圖片縮放拖拽功能的示例代碼

    vue3實(shí)現(xiàn)圖片縮放拖拽功能的示例代碼

    v3-drag-zoom 是基于 vue3 開發(fā)的一個(gè)縮放拖拽組件,方便開發(fā)者快速實(shí)現(xiàn)縮放拖拽功能,效果類似地圖的縮放與拖拽,本文給大家介紹了vue3如何快速實(shí)現(xiàn)圖片縮放拖拽功能,感興趣的朋友可以參考下
    2024-04-04
  • Vue實(shí)現(xiàn)帶參數(shù)的自定義指令示例

    Vue實(shí)現(xiàn)帶參數(shù)的自定義指令示例

    這篇文章主要為大家介紹了Vue實(shí)現(xiàn)帶參數(shù)的自定義指令示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-01-01
  • vue.js學(xué)習(xí)筆記之v-bind和v-on解析

    vue.js學(xué)習(xí)筆記之v-bind和v-on解析

    這篇文章主要介紹了vue.js學(xué)習(xí)筆記之v-bind和v-on解析,v-bind 指令用于響應(yīng)地更新 HTML 特征,v-on 指令用于監(jiān)聽DOM事件,文中還給大家提到了v-bind,v-on的縮寫,感興趣的朋友參考下吧
    2018-05-05
  • vue3(vite)設(shè)置代理封裝axios api解耦功能

    vue3(vite)設(shè)置代理封裝axios api解耦功能

    這篇文章主要介紹了vue3(vite)設(shè)置代理封裝axios api解耦,本文結(jié)合示例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2022-12-12
  • 一文帶你深入理解Vue3中Composition API的使用

    一文帶你深入理解Vue3中Composition API的使用

    Composition API 是 Vue 3 中的一項(xiàng)強(qiáng)大功能,它改進(jìn)了代碼組織和重用,使得構(gòu)建組件更加靈活和可維護(hù),本文我們將深入探討 Composition API 的各個(gè)方面,希望對大家有所幫助
    2023-10-10
  • vue調(diào)試工具vue-devtools的安裝全過程

    vue調(diào)試工具vue-devtools的安裝全過程

    這篇文章主要介紹了vue調(diào)試工具vue-devtools的安裝全過程,具有很好的參考價(jià)值,希望對大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-06-06
  • vue使用反向代理解決跨域問題方案

    vue使用反向代理解決跨域問題方案

    這篇文章主要為大家介紹了vue使用反向代理解決跨域問題方案詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-01-01
  • Vue實(shí)現(xiàn)電梯樣式錨點(diǎn)導(dǎo)航效果流程詳解

    Vue實(shí)現(xiàn)電梯樣式錨點(diǎn)導(dǎo)航效果流程詳解

    這篇文章主要介紹了Vue實(shí)現(xiàn)電梯樣式錨點(diǎn)導(dǎo)航效果流程,這種導(dǎo)航效果廣泛應(yīng)用于商城點(diǎn)餐購物情景,文中通過示例代碼介紹的很詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧
    2023-05-05
  • vue實(shí)現(xiàn)todolist基本功能以及數(shù)據(jù)存儲功能實(shí)例詳解

    vue實(shí)現(xiàn)todolist基本功能以及數(shù)據(jù)存儲功能實(shí)例詳解

    本文通過實(shí)例代碼給大家介紹了vue實(shí)現(xiàn)todolist基本功能以及數(shù)據(jù)存儲功能,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-04-04
  • vue3搭配pinia的踩坑實(shí)戰(zhàn)記錄

    vue3搭配pinia的踩坑實(shí)戰(zhàn)記錄

    Pinia是一個(gè)同時(shí)支持Vue2和Vue3的應(yīng)用狀態(tài)管理工具,簡單來說就是為了管理整個(gè)應(yīng)用中的響應(yīng)式數(shù)據(jù),解決各個(gè)組件交互時(shí)數(shù)據(jù)狀態(tài)的不好管理的問題,下面這篇文章主要給大家介紹了關(guān)于vue3搭配pinia踩坑的相關(guān)資料,需要的朋友可以參考下
    2022-04-04

最新評論

汉阴县| 永丰县| 台南市| 手游| 南京市| 新宁县| 岳池县| 和静县| 吉首市| 射阳县| 南漳县| 苍溪县| 天台县| 延庆县| 梁山县| 阜阳市| 宝山区| 民丰县| 原阳县| 庆云县| 黑水县| 西城区| 梧州市| 霞浦县| 江油市| 顺平县| 会同县| 克什克腾旗| 云梦县| 大荔县| 额敏县| 芦溪县| 吕梁市| 丹东市| 闽清县| 抚顺县| 新津县| 武隆县| 淳化县| 石泉县| 曲沃县|