Skip to content

Commit e48fdcd

Browse files
committed
feat: use svg as expender
1 parent efb04fd commit e48fdcd

File tree

5 files changed

+39
-18
lines changed

5 files changed

+39
-18
lines changed

src/icons/add-circle.svg

Lines changed: 7 additions & 0 deletions
Loading

src/icons/minus-circle.svg

Lines changed: 7 additions & 0 deletions
Loading

src/index.less

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,22 @@
150150
}
151151
epd {
152152
position: absolute;
153-
height: 12px;
154-
width: 12px;
155-
line-height: 12px;
153+
height: 18px;
154+
width: 18px;
155+
// line-height: 12px;
156156
text-align: center;
157-
border-radius: 50%;
158-
border: 1px solid #4f4f4f;
159-
background-color: #fff;
157+
// border-radius: 50%;
158+
// border: 1px solid #4f4f4f;
159+
// background-color: #fff;
160+
background-image: url('./icons/add-circle.svg');
161+
background-repeat: no-repeat;
162+
background-size: contain;
163+
background-position: center;
164+
160165
pointer-events: all;
161166
z-index: 9;
162167
&.minus {
168+
background-image: url('./icons/minus-circle.svg') !important;
163169
transition: all 0.3s;
164170
opacity: 0;
165171
&:hover {

src/utils/dom.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export function createInputDiv(tpc: Topic) {
162162
export const createExpander = function(expanded: boolean | undefined): Expander {
163163
const expander: Expander = $d.createElement('epd')
164164
// 包含未定义 expanded 的情况,未定义视为展开
165-
expander.innerText = expanded !== false ? '-' : '+'
165+
// expander.innerText = expanded !== false ? '' : ''
166166
expander.expanded = expanded !== false
167167
expander.className = expanded !== false ? 'minus' : ''
168168
return expander

webpack.config.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,18 @@ let config = {
2727
test: /\.css$/,
2828
use: ['style-loader', 'css-loader'],
2929
},
30-
{
31-
test: /\.(ttf|woff|woff2|eot|svg)$/i,
32-
use: [
33-
{
34-
loader: 'url-loader',
35-
options: {
36-
limit: 8192,
37-
},
38-
},
39-
],
40-
},
30+
{ test: /\.svg/, type: 'asset/inline' },
31+
// {
32+
// test: /\.(ttf|woff|woff2|eot|svg)$/i,
33+
// use: [
34+
// {
35+
// loader: 'url-loader',
36+
// options: {
37+
// limit: false,
38+
// },
39+
// },
40+
// ],
41+
// },
4142
],
4243
},
4344
}

0 commit comments

Comments
 (0)