fix(layer): 使用 guid 作为 layer 实例的唯一标识
This commit is contained in:
parent
9e4f2918d5
commit
6f19ff7c9b
@ -89,6 +89,7 @@ export default {
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, onUpdated, ref, useSlots, watch } from 'vue'
|
||||
import useMove from '../../hooks/useMove'
|
||||
import { guid } from '../../tools/guidUtil'
|
||||
|
||||
const slot = useSlots()
|
||||
|
||||
@ -120,7 +121,7 @@ const props = withDefaults(
|
||||
btnAlign?: string
|
||||
}>(),
|
||||
{
|
||||
id: 'layer',
|
||||
id: 'layer-' + guid(),
|
||||
zIndex: 99999999,
|
||||
title: '标题',
|
||||
offset: () => ['50%', '50%'],
|
||||
|
7
src/tools/guidUtil.ts
Normal file
7
src/tools/guidUtil.ts
Normal file
@ -0,0 +1,7 @@
|
||||
export function S4() {
|
||||
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
|
||||
};
|
||||
|
||||
export function guid() {
|
||||
return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user