Skip to content

Commit 9b18a5f

Browse files
xutaotaoxutaotao
authored andcommitted
fix: check box and button loading style
1 parent c16b04c commit 9b18a5f

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

packages/n-button/index.scss

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@ button{
1515
font-size: 14px;
1616
line-height: 36px;
1717
cursor:pointer;
18+
.nbutton-content{
19+
display: flex;
20+
justify-content: center;
21+
}
1822
.nbutton-icon{
1923
display: inline-block;
20-
margin-right: 0.2em;
24+
margin-right: 8px;
2125
}
2226
}
2327

@@ -99,4 +103,8 @@ button{
99103
height: 24px;
100104
font-size: 12px;
101105
padding: 2px 8px;
106+
}
107+
108+
.nbutton-slot{
109+
text-align: center;
102110
}

packages/n-button/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ const NButton = defineComponent({
4444

4545
return () => (
4646
<button class={classString} disabled={disabled}>
47-
{renderIcon()}
48-
{slots.default && slots.default()}
47+
<div class="nbutton-content">
48+
{renderIcon()}
49+
<span class="nbutton-slot">{slots.default && slots.default()}</span>
50+
</div>
4951
</button>
5052
);
5153
}

packages/n-checkbox/index.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineComponent, App,PropType,HTMLAttributes, SetupContext } from 'vue';
1+
import { defineComponent, App, PropType, SetupContext } from 'vue';
22
import './index.scss';
33
import { guid } from '../../src/utils/util';
44

@@ -21,8 +21,6 @@ const nCheckbox = defineComponent({
2121
name: 'NCheckbox',
2222
props: CheckboxProps,
2323
setup (props, { slots }: SetupContext) {
24-
25-
2624
const id = guid();
2725
const checkeval = () => {
2826
if (props.checked) {
@@ -32,8 +30,8 @@ const nCheckbox = defineComponent({
3230
};
3331
return () => (
3432
<div class="n-checkbox">
35-
<input id={id} class={[props.disabled ? 'n-checkbox-disble': '']} disabled={props.disabled} type="checkbox" checked={checkeval()}/>
36-
<label for={id} class={[props.disabled ? 'n-checkbox-disble': '']}/>
33+
<input id={id} class={[props.disabled ? 'n-checkbox-disble' : '']} disabled={props.disabled} type="checkbox" checked={checkeval()}/>
34+
<label for={id} class={[props.disabled ? 'n-checkbox-disble' : '']}/>
3735
<div class="slot-text">
3836
{slots.default && slots.default()}
3937
</div>

0 commit comments

Comments
 (0)