Open mishe opened 8 years ago
唯一ID的需求非常多,很多类库都有类似的函数,来实现这个唯一性;
但在前端方面,很难有真正意义上的唯一性,只能来尽量的降低重合几率。
uniqID: function (string) { string = string || ''; return string + Math.random().toString(36).substr(2, 10); },
唯一ID
唯一ID的需求非常多,很多类库都有类似的函数,来实现这个唯一性;
但在前端方面,很难有真正意义上的唯一性,只能来尽量的降低重合几率。
下面的看看我这边的唯一ID的函数源码