n20-common-lib 2.17.8 → 2.17.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n20-common-lib",
3
- "version": "2.17.8",
3
+ "version": "2.17.10",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="approve-msg-slt">
2
+ <div class="approve-msg-slt tips">
3
3
  <!-- <el-select
4
4
  v-model="approveMsgSlt"
5
5
  class="w-100p"
@@ -326,7 +326,7 @@ export default {
326
326
  </script>
327
327
 
328
328
  <style>
329
- .approve-msg-slt {
329
+ .tips {
330
330
  text-align: right;
331
331
  margin-right: 60px;
332
332
  margin-top: -24px;
@@ -32,7 +32,14 @@ class Watermark {
32
32
  ctx.fillStyle = options.textColor
33
33
  ctx.textAlign = 'left'
34
34
  ctx.textBaseline = 'Middle'
35
- ctx.fillText(options.text, can.width / 10, can.height / 2)
35
+ // 支持换行符分割文本
36
+ const lines = options.text.split('\n')
37
+ const lineHeight = parseInt(options.font) * 1.2 // 行高设为字体大小的1.2倍
38
+ const startY = can.height / 2 - ((lines.length - 1) * lineHeight) / 2
39
+
40
+ lines.forEach((line, index) => {
41
+ ctx.fillText(line, can.width / 10, startY + index * lineHeight)
42
+ })
36
43
 
37
44
  return can.toDataURL('image/png')
38
45
  }