Skip to content

Commit aee7f7f

Browse files
committed
Feat: Added safeId mixin
1 parent e6507e0 commit aee7f7f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/mixins/safeId.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export default{
2+
id: {
3+
type: String,
4+
default: null
5+
},
6+
computed: {
7+
safeId () {
8+
if(this.id)
9+
return this.id
10+
11+
return Math.random().toString(36).replace('0.', '') + (new Date()).getTime().toString(36)
12+
}
13+
}
14+
}

0 commit comments

Comments
 (0)