11<script setup lang="ts">
2- import { ElBacktop , ElButton , ElCheckbox , ElIcon , ElOption , ElSelect , ElTable , ElTableColumn , ElText , ElTooltip } from ' element-plus'
2+ import { ElBacktop , ElButton , ElCheckbox , ElIcon , ElInput , ElOption , ElSelect , ElTable , ElTableColumn , ElText , ElTooltip } from ' element-plus'
3+ import { defineComponent , h } from ' vue'
34import { useDevToolsPanel } from ' ./hooks/useDevToolsPanel'
45import { filterJoin } from ' ./utils'
56
67const {
8+ inputValue,
9+
710 selectedEl,
811 renderCssDiffs,
912 isAllProperty,
@@ -12,6 +15,28 @@ const {
1215 onTableRowClassName,
1316 handleCopyStyle,
1417} = useDevToolsPanel ()
18+
19+ const PropertyNode = defineComponent ({
20+ props: {
21+ text: {
22+ type: String ,
23+ },
24+ },
25+ setup(props ) {
26+ return () => {
27+ if (! inputValue .value ) {
28+ return h (' div' , props .text )
29+ }
30+ else {
31+ const result = inputValue .value .replace (/ [. *+?^${}()|[\]\\ ] / g , ' \\ $&' )
32+ const reg = new RegExp (` (${result }) ` , ' gi' )
33+
34+ const text = props .text ! .replace (reg , ' <span class=\' text-[#409eff]\' >$1</span>' )
35+ return h (' div' , { innerHTML: text })
36+ }
37+ }
38+ },
39+ })
1540 </script >
1641
1742<template >
@@ -38,7 +63,9 @@ const {
3863 {{ $t('selectedInfo') }}
3964 </ElText >
4065
41- <div class =" flex justify-end" >
66+ <div class =" flex justify-between my-3" >
67+ <ElInput v-model =" inputValue" :placeholder =" $t('inputPlaceholder')" clearable class =" !w-[50%]" />
68+
4269 <ElCheckbox v-model =" isAllProperty" :label =" $t('isAllProperty')" />
4370 </div >
4471 <ElTable
@@ -49,7 +76,11 @@ const {
4976 :row-class-name =" onTableRowClassName"
5077 @cell-click =" handleCopyStyle"
5178 >
52- <ElTableColumn prop =" property" :label =" $t('property')" />
79+ <ElTableColumn prop =" property" :label =" $t('property')" >
80+ <template #default =" scope " >
81+ <PropertyNode :text =" scope.row.property" />
82+ </template >
83+ </ElTableColumn >
5384 <template v-for =" (el ) in selectedEl " :key =" el .valueType " >
5485 <ElTableColumn :prop =" el.valueType" >
5586 <template #header >
0 commit comments