Skip to content

Commit 11f56ad

Browse files
committed
refactor: refactor safeId mixin
1 parent e5db365 commit 11f56ad

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/mixins/safeId.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
export default{
22
computed: {
33
safeId () {
4-
if(this.id || this.$attrs.id)
4+
if (this.id || this.$attrs.id) {
55
return this.id || this.$attrs.id
6+
}
67
return generateSafeId()
78
}
89
}
910
}
1011

1112
function generateSafeId () {
12-
const key = Math.random().toString(36).replace('0.', '') +
13-
(new Date()).getTime().toString(36)
14-
return '__safe_id__' + key
13+
const key = Math.random().toString(36).replace('0.', '')
14+
return '_safe_id_' + key
1515
}

0 commit comments

Comments
 (0)