fix: search input component cannot be rendered normally under a non-secure domain name (#4260)

#### What type of PR is this?

/area console
/kind bug
/milestone 2.8.x

#### What this PR does / why we need it:

修复在非安全域名下,SearchInput 组件无法正常渲染的问题,因为使用了 crypto 接口来随机生成表单的 id。但 crypto 在非安全域名下无法被调用,参考:https://developer.mozilla.org/en-US/docs/Web/API/Crypto

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/4250

#### Does this PR introduce a user-facing change?

```release-note
None
```
pull/4241/head^2
Ryan Wang 2023-07-21 10:34:17 +08:00 committed by GitHub
parent 7ee6e050a2
commit 51848d8563
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -1,4 +1,5 @@
<script lang="ts" setup>
import { randomUUID } from "@/utils/id";
import { getNode, reset } from "@formkit/core";
import { IconCloseCircle } from "@halo-dev/components";
@ -16,7 +17,7 @@ const emit = defineEmits<{
(event: "update:modelValue", modelValue: string): void;
}>();
const id = `search-input-${crypto.randomUUID()}`;
const id = `search-input-${randomUUID()}`;
function handleReset() {
emit("update:modelValue", "");