Skip to content

Commit 6bc5f04

Browse files
committed
fix(useBase64): improve SSR compatibility
1 parent 3a1718b commit 6bc5f04

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/core/useBase64/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Ref, ref, unref, watch } from 'vue-demi'
2-
import { MaybeRef } from '@vueuse/shared'
2+
import { isClient, MaybeRef } from '@vueuse/shared'
33

44
export interface ToDataURLOptions {
55
/**
@@ -31,6 +31,9 @@ export function useBase64(
3131
const promise = ref() as Ref<Promise<string>>
3232

3333
function execute() {
34+
if (!isClient)
35+
return
36+
3437
promise.value = new Promise<string>((resolve, reject) => {
3538
try {
3639
const _target = unref(target)

0 commit comments

Comments
 (0)