import {Directive} from "@vue/runtime-core";
|
let upSvg = '<i class="el-icon"><svg class="icon" width="200" height="200" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M104.704 685.248a64 64 0 0090.496 0l316.8-316.8 316.8 316.8a64 64 0 0090.496-90.496L557.248 232.704a64 64 0 00-90.496 0L104.704 594.752a64 64 0 000 90.496z"/></svg></i>'
|
let downSvg = '<i class="el-icon"><svg class="icon" width="200" height="200" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M104.704 338.752a64 64 0 0190.496 0l316.8 316.8 316.8-316.8a64 64 0 0190.496 90.496L557.248 791.296a64 64 0 01-90.496 0L104.704 429.248a64 64 0 010-90.496z"/></svg></i>'
|
|
/**
|
* 显示更多查询条件
|
*/
|
export const hasShowQuery: Directive = {
|
mounted(el, binding, vNode) {
|
const {value} = binding;
|
if (el.children.length >value){
|
for (let i = value; i < el.children.length; i++) {
|
el.children[i].style.display = "none"
|
}
|
el.style.position = 'relative'
|
let a = `<div class="el-form-item el-form-item--default" style="position: absolute;right: 0px;margin: 0;top: 10px"><div class="el-form-item__content"> <a class="el-link el-link--primary" style="margin-left: 10px;" id="zk">${downSvg}</a></div></div>`;
|
let aFrag = document.createRange().createContextualFragment(a);
|
el.appendChild(aFrag)
|
el.lastChild.addEventListener('click',function (e:any) {
|
let lastChild = el.lastChild.lastChild.childNodes[1];
|
if (lastChild.id === 'zk'){
|
lastChild.id = 'sk';
|
let upSvgFrag = document.createRange().createContextualFragment(upSvg);
|
lastChild.replaceChild(upSvgFrag,lastChild.childNodes[0])
|
for (let i = value; i < el.children.length-1; i++) {
|
el.children[i].style.display = "inline-flex"
|
}
|
}else{
|
lastChild.id = 'zk'
|
let downSvgFrag = document.createRange().createContextualFragment(downSvg);
|
lastChild.replaceChild(downSvgFrag,lastChild.childNodes[0])
|
for (let i = value; i < el.children.length-1; i++) {
|
el.children[i].style.display = "none"
|
}
|
}
|
})
|
|
}
|
|
}
|
}
|
/**
|
* 显示更多操作功能
|
*/
|
export const hasShowListOpt: Directive = {
|
mounted(el, binding, vNode) {
|
const {value} = binding;
|
if (el.children.length >value){
|
el.style="margin-right:12px";
|
for (let i = value; i < el.children.length; i++) {
|
el.children[i].style.display = "none"
|
}
|
let a = `<div class="el-form-item el-form-item--default" style="position: absolute;right: 5%;margin: 0;top: 17px;text-align: right"><div class="el-form-item__content"> <a class="el-link el-link--primary" style="margin-left: 10px;" id="zk">${downSvg}</a></div></div>`;
|
let aFrag = document.createRange().createContextualFragment(a);
|
el.appendChild(aFrag)
|
el.lastChild.addEventListener('click',function (e:any) {
|
let lastChild = el.lastChild.lastChild.childNodes[1];
|
if (lastChild.id === 'zk'){
|
lastChild.id = 'sk';
|
let upSvgFrag = document.createRange().createContextualFragment(upSvg);
|
lastChild.replaceChild(upSvgFrag,lastChild.childNodes[0])
|
for (let i = value; i < el.children.length-1; i++) {
|
el.children[i].style.display = "inline"
|
}
|
}else{
|
lastChild.id = 'zk'
|
let downSvgFrag = document.createRange().createContextualFragment(downSvg);
|
lastChild.replaceChild(downSvgFrag,lastChild.childNodes[0])
|
for (let i = value; i < el.children.length-1; i++) {
|
el.children[i].style.display = "none"
|
}
|
}
|
})
|
|
}
|
|
}
|
}
|