@ericbyliang/miniprogram 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +4 -0
- package/package.json +18 -0
- package/src/common/index.js +5 -0
- package/src/watermark/index.js +73 -0
- package/src/watermark/index.json +5 -0
- package/src/watermark/index.wxml +9 -0
- package/src/watermark/index.wxss +20 -0
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ericbyliang/miniprogram",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Wechat miniprogram global watermark component",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"miniprogram": "src",
|
|
7
|
+
"files": [
|
|
8
|
+
"src"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"miniprogram",
|
|
13
|
+
"watermark",
|
|
14
|
+
"wechat"
|
|
15
|
+
],
|
|
16
|
+
"author": "ericbyliang",
|
|
17
|
+
"license": "MIT"
|
|
18
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Component({
|
|
2
|
+
lifetimes: {
|
|
3
|
+
ready: function () {
|
|
4
|
+
}
|
|
5
|
+
},
|
|
6
|
+
/**
|
|
7
|
+
* 组件的属性列表
|
|
8
|
+
*/
|
|
9
|
+
properties: {
|
|
10
|
+
text: {
|
|
11
|
+
type: String,
|
|
12
|
+
value: wx.getStorageSync('$&watermark_text$*&') || '',
|
|
13
|
+
observer: function (newVal, oldVal) {
|
|
14
|
+
this.setData({
|
|
15
|
+
text: newVal,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
textSize: {
|
|
20
|
+
type: Number,
|
|
21
|
+
value: 28,
|
|
22
|
+
observer: function (newVal, oldVal) {
|
|
23
|
+
this.setData({
|
|
24
|
+
textSize: newVal,
|
|
25
|
+
});
|
|
26
|
+
} },
|
|
27
|
+
textColor: {
|
|
28
|
+
type: String,
|
|
29
|
+
value: 'rgba(80,80,80,0.08)' ,
|
|
30
|
+
observer: function (newVal, oldVal) {
|
|
31
|
+
this.setData({
|
|
32
|
+
textColor: newVal,
|
|
33
|
+
});
|
|
34
|
+
}},
|
|
35
|
+
rotate: {
|
|
36
|
+
type: Number,
|
|
37
|
+
value: -20,
|
|
38
|
+
observer: function (newVal, oldVal) {
|
|
39
|
+
this.setData({
|
|
40
|
+
rotate: newVal,
|
|
41
|
+
});
|
|
42
|
+
} },
|
|
43
|
+
gapX: {
|
|
44
|
+
type: Number,
|
|
45
|
+
value: 180 ,
|
|
46
|
+
observer: function (newVal, oldVal) {
|
|
47
|
+
this.setData({
|
|
48
|
+
gapX: newVal,
|
|
49
|
+
});
|
|
50
|
+
}},
|
|
51
|
+
gapY: {
|
|
52
|
+
type: Number,
|
|
53
|
+
value: 120,
|
|
54
|
+
observer: function (newVal, oldVal) {
|
|
55
|
+
this.setData({
|
|
56
|
+
gapY: newVal,
|
|
57
|
+
});
|
|
58
|
+
} }
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* 组件的初始数据
|
|
63
|
+
*/
|
|
64
|
+
data: {
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* 组件的方法列表
|
|
69
|
+
*/
|
|
70
|
+
methods: {
|
|
71
|
+
|
|
72
|
+
}
|
|
73
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<view class="watermark" style="transform: rotate({{rotate}}deg);color: {{textColor}};font-size: {{textSize}}rpx;">
|
|
2
|
+
<block wx:for="{{60}}" wx:key="row">
|
|
3
|
+
<view class="watermark-row" style="margin-left: {{index % 2 === 0 ? 0 : gapX / 2}}rpx;margin-bottom: {{gapY}}rpx;">
|
|
4
|
+
<block wx:for="{{15}}" wx:key="col">
|
|
5
|
+
<text class="watermark-col" style="margin-right: {{gapX}}rpx;">{{text}}</text>
|
|
6
|
+
</block>
|
|
7
|
+
</view>
|
|
8
|
+
</block>
|
|
9
|
+
</view>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.watermark {
|
|
2
|
+
position: fixed;
|
|
3
|
+
width: 200vw;
|
|
4
|
+
height: 150vh;
|
|
5
|
+
top: -20vw;
|
|
6
|
+
left: -50vw;
|
|
7
|
+
|
|
8
|
+
z-index: 1000000;
|
|
9
|
+
pointer-events: none;
|
|
10
|
+
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.watermark-row {
|
|
15
|
+
white-space: nowrap;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.watermark-col {
|
|
19
|
+
display: inline-block;
|
|
20
|
+
}
|