增加过滤功能

This commit is contained in:
xyf-mac 2021-11-12 22:21:49 +08:00
parent 96e8a883a4
commit 6a3f3d7592
9 changed files with 94 additions and 8 deletions

View File

@ -22,6 +22,10 @@
} }
} }
.el-input-group__append {
padding: 0;
}
.el-tree { .el-tree {
width: 100%; width: 100%;
} }

View File

@ -54,6 +54,12 @@
<div class="content unicode" style="display: block;"> <div class="content unicode" style="display: block;">
<ul class="icon_lists dib-box"> <ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont">&#xe7b9;</span>
<div class="name">font-size</div>
<div class="code-name">&amp;#xe7b9;</div>
</li>
<li class="dib"> <li class="dib">
<span class="icon iconfont">&#xe626;</span> <span class="icon iconfont">&#xe626;</span>
<div class="name">车巴巴-未知项</div> <div class="name">车巴巴-未知项</div>
@ -90,9 +96,9 @@
<pre><code class="language-css" <pre><code class="language-css"
>@font-face { >@font-face {
font-family: 'iconfont'; font-family: 'iconfont';
src: url('iconfont.woff2?t=1624098111157') format('woff2'), src: url('iconfont.woff2?t=1636725471182') format('woff2'),
url('iconfont.woff?t=1624098111157') format('woff'), url('iconfont.woff?t=1636725471182') format('woff'),
url('iconfont.ttf?t=1624098111157') format('truetype'); url('iconfont.ttf?t=1636725471182') format('truetype');
} }
</code></pre> </code></pre>
<h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3> <h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
@ -118,6 +124,15 @@
<div class="content font-class"> <div class="content font-class">
<ul class="icon_lists dib-box"> <ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont el-icon-third-font-size"></span>
<div class="name">
font-size
</div>
<div class="code-name">.el-icon-third-font-size
</div>
</li>
<li class="dib"> <li class="dib">
<span class="icon iconfont el-icon-third-unknown"></span> <span class="icon iconfont el-icon-third-unknown"></span>
<div class="name"> <div class="name">
@ -172,6 +187,14 @@
<div class="content symbol"> <div class="content symbol">
<ul class="icon_lists dib-box"> <ul class="icon_lists dib-box">
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#el-icon-third-font-size"></use>
</svg>
<div class="name">font-size</div>
<div class="code-name">#el-icon-third-font-size</div>
</li>
<li class="dib"> <li class="dib">
<svg class="icon svg-icon" aria-hidden="true"> <svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#el-icon-third-unknown"></use> <use xlink:href="#el-icon-third-unknown"></use>

View File

@ -1,8 +1,8 @@
@font-face { @font-face {
font-family: "iconfont"; /* Project id 2620843 */ font-family: "iconfont"; /* Project id 2620843 */
src: url('iconfont.woff2?t=1624098111157') format('woff2'), src: url('iconfont.woff2?t=1636725471182') format('woff2'),
url('iconfont.woff?t=1624098111157') format('woff'), url('iconfont.woff?t=1636725471182') format('woff'),
url('iconfont.ttf?t=1624098111157') format('truetype'); url('iconfont.ttf?t=1636725471182') format('truetype');
} }
.iconfont ,[class='el-icon-third'],[class*=' el-icon-third']{ .iconfont ,[class='el-icon-third'],[class*=' el-icon-third']{
@ -13,6 +13,10 @@
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
.el-icon-third-font-size:before {
content: "\e7b9";
}
.el-icon-third-unknown:before { .el-icon-third-unknown:before {
content: "\e626"; content: "\e626";
} }

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,13 @@
"css_prefix_text": "el-icon-third-", "css_prefix_text": "el-icon-third-",
"description": "", "description": "",
"glyphs": [ "glyphs": [
{
"icon_id": "8794801",
"name": "font-size",
"font_class": "font-size",
"unicode": "e7b9",
"unicode_decimal": 59321
},
{ {
"icon_id": "1156016", "icon_id": "1156016",
"name": "车巴巴-未知项", "name": "车巴巴-未知项",

View File

@ -17,6 +17,16 @@
<el-button type="success" class="el-icon-refresh" @click="onBtnClickUpdateTree"></el-button> <el-button type="success" class="el-icon-refresh" @click="onBtnClickUpdateTree"></el-button>
</div> </div>
<div class="treeList"> <div class="treeList">
<el-input placeholder="输入关键字进行过滤" v-model="filterText">
<template slot="append">
<div class="matchCase ">
<div class="iconfont el-icon-third-font-size" @click.stop="onChangeCase"
title="匹配大小写"
:style="{'color':matchCase?'red':''}">
</div>
</div>
</template>
</el-input>
<el-tree :data="treeData" <el-tree :data="treeData"
ref="tree" ref="tree"
style="display: inline-block;" style="display: inline-block;"
@ -24,6 +34,7 @@
:highlight-current="true" :highlight-current="true"
:default-expand-all="false" :default-expand-all="false"
:default-expanded-keys="expandedKeys" :default-expanded-keys="expandedKeys"
:filter-node-method="filterNode"
:expand-on-click-node="false" :expand-on-click-node="false"
node-key="uuid" node-key="uuid"
@node-expand="onNodeExpand" @node-expand="onNodeExpand"
@ -51,7 +62,7 @@
<script lang="ts"> <script lang="ts">
import Vue from "vue"; import Vue from "vue";
import {Component} from "vue-property-decorator"; import {Component, Watch} from "vue-property-decorator";
import properties from "./propertys.vue"; import properties from "./propertys.vue";
import {Msg, Page, PluginEvent} from "@/core/types" import {Msg, Page, PluginEvent} from "@/core/types"
import {connectBackground} from "@/devtools/connectBackground"; import {connectBackground} from "@/devtools/connectBackground";
@ -70,6 +81,20 @@ export default class Index extends Vue {
expandedKeys: Array<string> = []; expandedKeys: Array<string> = [];
selectedUUID: string | null = null; selectedUUID: string | null = null;
filterText: string | null = null;
@Watch("filterText")
updateFilterText(val: any) {
(this.$refs?.tree as any)?.filter(val);
}
private matchCase = false;
onChangeCase() {
this.matchCase = !this.matchCase;
this.updateFilterText(this.filterText);
}
// el-treekey // el-treekey
defaultProps = { defaultProps = {
children: "children", children: "children",
@ -107,6 +132,19 @@ export default class Index extends Vue {
}); });
} }
filterNode(value: any, data: any) {
if (!value) {
return true;
} else {
if (this.matchCase) {
//
return data?.name?.indexOf(value) !== -1;
} else {
return data?.name?.toLowerCase().indexOf(value.toLowerCase()) !== -1;
}
}
}
_expand(uuid: string) { _expand(uuid: string) {
let expandKeys: Array<string> = []; let expandKeys: Array<string> = [];
@ -403,6 +441,16 @@ export default class Index extends Vue {
text-decoration: line-through; text-decoration: line-through;
} }
.matchCase {
width: 30px;
height: 26px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
&::-webkit-scrollbar { &::-webkit-scrollbar {
width: 6px; width: 6px;
height: 6px; height: 6px;