update 水印颜色、字体提出配置项

This commit is contained in:
赵霄
2024-01-02 14:50:02 +08:00
parent 64a66bad91
commit 74e6cdba16
3 changed files with 11 additions and 2 deletions
+4 -1
View File
@@ -2,7 +2,7 @@
<a-config-provider :locale="locale">
<div id="app">
<router-view v-if="isRouterAlive" />
<div class="watermark" v-if="show" v-watermark="{text: watermark, textColor: 'rgba(180, 180, 180, 0.2)'}"></div>
<div class="watermark" v-if="show" v-watermark="{text: watermark, textColor: watermarkConfig.color}"></div>
</div>
</a-config-provider>
</template>
@@ -37,6 +37,9 @@ export default {
return this.$store.getters.userInfo.username + this.$store.getters.userInfo.realname
}
return null
},
watermarkConfig () {
return window._CONFIG.watermarkConfig
}
},
watch: {
+2 -1
View File
@@ -16,7 +16,7 @@ Vue.directive('watermark', {
can.style.display = 'none'
const cans = can.getContext('2d')
cans.rotate(-20 * Math.PI / 180)
cans.font = font || '13px Microsoft Yahei'
cans.font = font || window._CONFIG.watermarkConfig.font
cans.fillStyle = textColor || '#DDDDDD'
cans.textAlign = 'left'
cans.textBaseline = 'Middle'
@@ -38,6 +38,7 @@ Vue.directive('watermark', {
parentNode.appendChild(div)
}
}
if (binding.value.text) {
addWaterMarker(binding.value.text, el, binding.value.width, binding.value.height, binding.value.font, binding.value.textColor, binding.value.fillTextX)
}