Skip to content

Commit 757e776

Browse files
committed
style: init done
1 parent 0c1183a commit 757e776

File tree

5 files changed

+157
-3
lines changed

5 files changed

+157
-3
lines changed
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
<demo-block title="Circular" padding>
2-
1+
<demo-block title="Loading Component" padding>
2+
<mp-loading></mp-loading>
33
</demo-block>

src/mp-loading/index.less

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
.spin-dot-wrap {
2+
/* position: fixed;
3+
top: 50%;
4+
left: 50%;
5+
z-index: 999;
6+
transform: translate(-50%, -50%); */
7+
.spin-dot-wrap-rotate {
8+
margin: 0 auto;
9+
height: 100%;
10+
transform: rotate(45deg);
11+
animation: rotate 1.2s infinite linear;
12+
.spin-dot-item {
13+
position: absolute;
14+
border-radius: 100%;
15+
opacity: 0.3;
16+
transform: scale(0.75);
17+
animation: spinMove 0.3s infinite linear alternate;
18+
&:nth-child(1) {
19+
top: 0;
20+
left: 0;
21+
}
22+
&:nth-child(2) {
23+
top: 0;
24+
right: 0;
25+
animation-delay: 0.4s;
26+
}
27+
&:nth-child(3) {
28+
bottom: 0;
29+
left: 0;
30+
animation-delay: 0.8s;
31+
}
32+
&:nth-child(4) {
33+
right: 0;
34+
bottom: 0;
35+
animation-delay: 1.2s;
36+
}
37+
}
38+
}
39+
.spin-tip {
40+
margin-top: 6px;
41+
text-align: center;
42+
font-size: 14px;
43+
}
44+
}
45+
@keyframes spinMove {
46+
to {
47+
opacity: 1;
48+
}
49+
}
50+
51+
@keyframes rotate {
52+
to {
53+
transform: rotate(405deg);
54+
}
55+
}

src/mp-loading/index.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Component({
2+
properties: {
3+
size: {
4+
type: Number,
5+
value: 30
6+
},
7+
color: {
8+
type: String,
9+
value: '#1890ff'
10+
}
11+
}
12+
})

src/mp-loading/index.wxml

+8-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
<view>ss</view>
1+
<View class='spin-dot-wrap'>
2+
<View class='spin-dot-wrap-rotate' style="width: {{ size }}px; height: {{ size }}px">
3+
<block wx:for="{{[1,2,3,4]}}" wx:key="{{item}}">
4+
<View class='spin-dot-item' style="width: {{ size/2 - 2}}px; height: {{ size/2 - 2}}px ;background-color: {{color}};" />
5+
</block>
6+
</View>
7+
<view class="spin-tip" style="color: {{color}}">加载中...</view>
8+
</View>

types/weapp.d.ts

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
type BehaviorOptions = {
2+
[key: string]: any & ThisType<any>
3+
};
4+
5+
declare function Behavior(options: BehaviorOptions): void
6+
declare function Component(options: any): void
7+
8+
declare namespace Weapp {
9+
interface Component {
10+
[key: string]: any
11+
getRelationNodes(selector: string): any[]
12+
setData(data: any, callback?: Function): void
13+
}
14+
15+
interface FormField {
16+
data: {
17+
name: string
18+
value: any
19+
}
20+
}
21+
22+
interface Target {
23+
id: string
24+
tagName: string
25+
dataset: {
26+
[key: string]: any
27+
}
28+
}
29+
30+
interface Event {
31+
/**
32+
* 代表事件的类型。
33+
*/
34+
type: string
35+
/**
36+
* 页面打开到触发事件所经过的毫秒数。
37+
*/
38+
timeStamp: number
39+
/**
40+
* 触发事件的源组件。
41+
*/
42+
target: Target
43+
/**
44+
* 事件绑定的当前组件。
45+
*/
46+
currentTarget: Target
47+
/**
48+
* 额外的信息
49+
*/
50+
detail: any
51+
}
52+
53+
interface Touch {
54+
/**
55+
* 触摸点的标识符
56+
*/
57+
identifier: number
58+
/**
59+
* 距离文档左上角的距离,文档的左上角为原点 ,横向为X轴,纵向为Y轴
60+
*/
61+
pageX: number
62+
/**
63+
* 距离文档左上角的距离,文档的左上角为原点 ,横向为X轴,纵向为Y轴
64+
*/
65+
pageY: number
66+
/**
67+
* 距离页面可显示区域(屏幕除去导航条)左上角距离,横向为X轴,纵向为Y轴
68+
*/
69+
clientX: number
70+
/**
71+
* 距离页面可显示区域(屏幕除去导航条)左上角距离,横向为X轴,纵向为Y轴
72+
*/
73+
clientY: number
74+
}
75+
76+
interface TouchEvent extends Event {
77+
touches: Array<Touch>
78+
changedTouches: Array<Touch>
79+
}
80+
}

0 commit comments

Comments
 (0)