Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a0feeb19
authored
Mar 31, 2025
by
Netfan
Committed by
GitHub
Mar 31, 2025
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: watermark settings in the preferences modified accidentally (#5823)
1 parent
df6341f0
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
9 deletions
apps/web-antd/src/layouts/basic.vue
apps/web-ele/src/layouts/basic.vue
apps/web-naive/src/layouts/basic.vue
packages/effects/hooks/src/use-watermark.ts
playground/src/layouts/basic.vue
apps/web-antd/src/layouts/basic.vue
View file @
a0feeb1
...
@@ -110,7 +110,7 @@ watch(
...
@@ -110,7 +110,7 @@ watch(
async
(
enable
)
=>
{
async
(
enable
)
=>
{
if
(
enable
)
{
if
(
enable
)
{
await
updateWatermark
({
await
updateWatermark
({
content
:
`
${
userStore
.
userInfo
?.
username
}
`,
content
:
`
${
userStore
.
userInfo
?.
username
}
-
$
{
userStore
.
userInfo
?.
realName
}
`,
});
});
} else {
} else {
destroyWatermark();
destroyWatermark();
...
...
apps/web-ele/src/layouts/basic.vue
View file @
a0feeb1
...
@@ -110,7 +110,7 @@ watch(
...
@@ -110,7 +110,7 @@ watch(
async
(
enable
)
=>
{
async
(
enable
)
=>
{
if
(
enable
)
{
if
(
enable
)
{
await
updateWatermark
({
await
updateWatermark
({
content
:
`
${
userStore
.
userInfo
?.
username
}
`,
content
:
`
${
userStore
.
userInfo
?.
username
}
-
$
{
userStore
.
userInfo
?.
realName
}
`,
});
});
} else {
} else {
destroyWatermark();
destroyWatermark();
...
...
apps/web-naive/src/layouts/basic.vue
View file @
a0feeb1
...
@@ -111,7 +111,7 @@ watch(
...
@@ -111,7 +111,7 @@ watch(
async
(
enable
)
=>
{
async
(
enable
)
=>
{
if
(
enable
)
{
if
(
enable
)
{
await
updateWatermark
({
await
updateWatermark
({
content
:
`
${
userStore
.
userInfo
?.
username
}
`,
content
:
`
${
userStore
.
userInfo
?.
username
}
-
$
{
userStore
.
userInfo
?.
realName
}
`,
});
});
} else {
} else {
destroyWatermark();
destroyWatermark();
...
...
packages/effects/hooks/src/use-watermark.ts
View file @
a0feeb1
...
@@ -2,8 +2,6 @@ import type { Watermark, WatermarkOptions } from 'watermark-js-plus';
...
@@ -2,8 +2,6 @@ import type { Watermark, WatermarkOptions } from 'watermark-js-plus';
import
{
nextTick
,
onUnmounted
,
readonly
,
ref
}
from
'vue'
;
import
{
nextTick
,
onUnmounted
,
readonly
,
ref
}
from
'vue'
;
import
{
updatePreferences
}
from
'@vben/preferences'
;
const
watermark
=
ref
<
Watermark
>
();
const
watermark
=
ref
<
Watermark
>
();
const
unmountedHooked
=
ref
<
boolean
>
(
false
);
const
unmountedHooked
=
ref
<
boolean
>
(
false
);
const
cachedOptions
=
ref
<
Partial
<
WatermarkOptions
>>
({
const
cachedOptions
=
ref
<
Partial
<
WatermarkOptions
>>
({
...
@@ -48,7 +46,6 @@ export function useWatermark() {
...
@@ -48,7 +46,6 @@ export function useWatermark() {
...
options
,
...
options
,
};
};
watermark
.
value
=
new
Watermark
(
cachedOptions
.
value
);
watermark
.
value
=
new
Watermark
(
cachedOptions
.
value
);
updatePreferences
({
app
:
{
watermark
:
true
}
});
await
watermark
.
value
?.
create
();
await
watermark
.
value
?.
create
();
}
}
...
@@ -69,7 +66,6 @@ export function useWatermark() {
...
@@ -69,7 +66,6 @@ export function useWatermark() {
watermark
.
value
.
destroy
();
watermark
.
value
.
destroy
();
watermark
.
value
=
undefined
;
watermark
.
value
=
undefined
;
}
}
updatePreferences
({
app
:
{
watermark
:
false
}
});
}
}
// 只在第一次调用时注册卸载钩子,防止重复注册以致于在路由切换时销毁了水印
// 只在第一次调用时注册卸载钩子,防止重复注册以致于在路由切换时销毁了水印
...
...
playground/src/layouts/basic.vue
View file @
a0feeb1
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
import
type
{
NotificationItem
}
from
'@vben/layouts'
;
import
type
{
NotificationItem
}
from
'@vben/layouts'
;
import
{
computed
,
ref
,
watch
}
from
'vue'
;
import
{
computed
,
onBeforeMount
,
ref
,
watch
}
from
'vue'
;
import
{
AuthenticationLoginExpiredModal
}
from
'@vben/common-ui'
;
import
{
AuthenticationLoginExpiredModal
}
from
'@vben/common-ui'
;
import
{
VBEN_DOC_URL
,
VBEN_GITHUB_URL
}
from
'@vben/constants'
;
import
{
VBEN_DOC_URL
,
VBEN_GITHUB_URL
}
from
'@vben/constants'
;
...
@@ -126,7 +126,7 @@ watch(
...
@@ -126,7 +126,7 @@ watch(
async
(
enable
)
=>
{
async
(
enable
)
=>
{
if
(
enable
)
{
if
(
enable
)
{
await
updateWatermark
({
await
updateWatermark
({
content
:
`
${
userStore
.
userInfo
?.
username
}
`,
content
:
`
${
userStore
.
userInfo
?.
username
}
-
$
{
userStore
.
userInfo
?.
realName
}
`,
});
});
} else {
} else {
destroyWatermark();
destroyWatermark();
...
@@ -136,6 +136,12 @@ watch(
...
@@ -136,6 +136,12 @@ watch(
immediate: true,
immediate: true,
},
},
);
);
onBeforeMount(() => {
if (preferences.app.watermark) {
destroyWatermark();
}
});
</
script
>
</
script
>
<
template
>
<
template
>
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment