vue懸浮表單復(fù)合組件開發(fā)詳解
本文實(shí)例為大家分享了vue懸浮表單復(fù)合組件開發(fā)的具體代碼,供大家參考,具體內(nèi)容如下
組件樣式
組件功能
卡片形式展示篩選條件
點(diǎn)擊添加篩選后展示懸浮表單
表單內(nèi)完成條件選擇后點(diǎn)擊保存,新增一個(gè)卡片
開發(fā)
<div class="form-label">篩選條件:</div> <template v-for="(item, index) in fitter"> ? <div :key="index" class="form-input-tab"> ? ? <span :title="item">{{ item }}</span> ? ? <span @click="deleteTab(item)" class="form-input-close"><a-icon type="close" /></span> ? </div> </template> <a-popover ? trigger="click" ? placement="bottom" ? :visible="visible" ? @visibleChange="handleClickChange" > ? <template slot="content"> ? ? <div style="width: 420px; height: 220px; position: relative"> ? ? ? <TipMes message="編輯篩選"></TipMes> ? ? ? <a-row> ? ? ? ? <a-col :span="12"> ? ? ? ? ? <div class="select-title">字段</div> ? ? ? ? ? <a-select ? ? ? ? ? ? allowClear ? ? ? ? ? ? style="width: 189px" ? ? ? ? ? ? placeholder="請(qǐng)選擇字段" ? ? ? ? ? ? v-model="selectField" ? ? ? ? ? ? @change="getQueryConditions" ? ? ? ? ? > ? ? ? ? ? ? <a-select-option ? ? ? ? ? ? ? v-for="(item, index) in editField" ? ? ? ? ? ? ? :value="item.fieldName + '//' + item.fieldType" ? ? ? ? ? ? ? :key="index" ? ? ? ? ? ? ? >{{ item.fieldName }}</a-select-option ? ? ? ? ? ? > ? ? ? ? ? </a-select> ? ? ? ? </a-col> ? ? ? ? <a-col :span="12"> ? ? ? ? ? <div class="select-title">運(yùn)算符</div> ? ? ? ? ? <a-select ? ? ? ? ? ? allowClear ? ? ? ? ? ? style="width: 189px" ? ? ? ? ? ? placeholder="請(qǐng)選擇運(yùn)算符" ? ? ? ? ? ? v-model="conditionName" ? ? ? ? ? > ? ? ? ? ? ? <a-select-option ? ? ? ? ? ? ? v-for="(item, index) in condition" ? ? ? ? ? ? ? :value="item.conditionName" ? ? ? ? ? ? ? :key="index" ? ? ? ? ? ? > ? ? ? ? ? ? ? {{ item.conditionDesc }} ? ? ? ? ? ? </a-select-option> ? ? ? ? ? </a-select> ? ? ? ? </a-col> ? ? ? </a-row> ? ? ? <div v-show="this.conditionName !== 'NotExists' && this.conditionName !== 'Exists'"> ? ? ? ? <div class="select-title">值</div> ? ? ? ? <a-select ? ? ? ? ? allowClear ? ? ? ? ? style="width: 399px" ? ? ? ? ? placeholder="請(qǐng)選擇值" ? ? ? ? ? v-model="conditionContent" ? ? ? ? ? v-show="selectField && selectField.split('//')[1] === 'boolean'" ? ? ? ? > ? ? ? ? ? <a-select-option value="true" :key="0">true</a-select-option> ? ? ? ? ? <a-select-option value="false" :key="1">false</a-select-option> ? ? ? ? </a-select> ? ? ? ? <a-input ? ? ? ? ? allowClear ? ? ? ? ? v-model="conditionContent" ? ? ? ? ? style="width: 399px" ? ? ? ? ? placeholder="請(qǐng)輸入值" ? ? ? ? ? v-show="(selectField && selectField.split('//')[1] !== 'boolean') || !selectField" ? ? ? ? /> ? ? ? </div> ? ? ? <div class="button-container"> ? ? ? ? <a-button style="margin-right: 10px; width: 75px" @click="cancelSearch" ? ? ? ? ? >取消</a-button ? ? ? ? > ? ? ? ? <a-button type="primary" style="width: 75px" @click="saveSearch">保存</a-button> ? ? ? </div> ? ? </div> ? </template> ? <div class="add-text"> ? ? <svg-icon class="add-svg" icon-class="topic-push" /> ? ? <span style="margin-left: 22px">添加篩選</span> ? </div> </a-popover>
JS:
//刪除篩選條件 deleteTab(item) { ? this.fitter.splice(this.fitter.indexOf(item), 1); ? this.queryParams.conditionDeatils.splice( ? ? this.queryParams.conditionDeatils.indexOf(item.split(':')[0]), ? ? 1 ? ); ? this.getSearchList(); }, //展示篩選框 handleClickChange(visible) { ? this.visible = visible; }, //取消篩選條件的添加 cancelSearch() { ? this.visible = false; ? this.selectField = undefined; ? this.conditionName = undefined; ? this.conditionContent = undefined; ? this.condition = []; }, //保存篩選條件 saveSearch() {},
CSS
.form-label { ? margin: 10px 0 15px 20px; ? display: inline-block; ? float: left; ? color: rgba(0, 0, 0, 0.85); } .form-input-tab { ? display: inline-block; ? float: left; ? height: 26px; ? margin: 10px 4px; ? padding: 0 5px 0 10px; ? line-height: 22px; ? color: #333333; ? border: 1px solid #c6d3e3; ? border-radius: 4px; ? cursor: default; } .form-input-close { ? color: #4f6785; ? cursor: pointer; ? margin-left: 1px; ? float: right; } .select-title { ? font-size: 14px; ? color: #333333; ? font-weight: 500; ? margin: 8px 0 6px 0; } .button-container { ? position: absolute; ? bottom: 10px; ? right: 20px; } .add-text { ? display: inline-block; ? position: relative; ? margin: 10px 0 15px 10px; ? color: #0f88ff; ? cursor: pointer; } .add-svg { ? width: 18px; ? height: 18px; ? position: absolute; ? top: 3px; }
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- vue使用Element組件時(shí)v-for循環(huán)里的表單項(xiàng)驗(yàn)證方法
- Vue2.0表單校驗(yàn)組件vee-validate的使用詳解
- vue組件表單數(shù)據(jù)回顯驗(yàn)證及提交的實(shí)例代碼
- Vue表單類的父子組件數(shù)據(jù)傳遞示例
- 詳解vue表單驗(yàn)證組件 v-verify-plugin
- Vue form表單動(dòng)態(tài)添加組件實(shí)戰(zhàn)案例
- vue動(dòng)態(tài)綁定組件子父組件多表單驗(yàn)證功能的實(shí)現(xiàn)代碼
- 使用form-create動(dòng)態(tài)生成vue自定義組件和嵌套表單組件
- vue2.0數(shù)據(jù)雙向綁定與表單bootstrap+vue組件
- 利用Vue v-model實(shí)現(xiàn)一個(gè)自定義的表單組件
相關(guān)文章
vue-devtools?開發(fā)工具插件之支持vue3?chrome?瀏覽器插件
這篇文章主要介紹了vue-devtools?開發(fā)工具插件之支持vue3?chrome?瀏覽器插件,用這個(gè)版本主要是為了支持vue3?推薦直接下載,文中給大家提供了下載地址,感興趣的朋友跟隨小編一起看看吧2022-01-01vue3 watch和watchEffect的使用以及有哪些區(qū)別
這篇文章主要介紹了vue3 watch和watchEffect的使用以及有哪些區(qū)別,幫助大家更好的理解和學(xué)習(xí)vue框架,感興趣的朋友可以了解下2021-01-01vue-cli項(xiàng)目使用mock數(shù)據(jù)的方法(借助express)
現(xiàn)如今前后端分離開發(fā)越來越普遍,前端人員寫好頁面后可以自己模擬一些數(shù)據(jù)進(jìn)行代碼測(cè)試,這樣就不必等后端接口,提高了我們開發(fā)效率。今天就來分析下前端常用的mock數(shù)據(jù)的方式是如何實(shí)現(xiàn)的,需要的朋友可以參考下2019-04-04