utils/utils.js 文件

const S4 = function() {
  return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
};
export function guid() {
  return (S4() + S4() +'-' +S4() +'-' +S4() +'-' +S4() +'-' +S4() +S4() +S4()
  );
}
import { guid } from '@/utils/utils';

 created() {
 	console.log(this.guid()); //679f0f92-e821-bbea-7536-8b4bb830f96d
 },
 methods: {
	 guid ,
 }
Logo

前往低代码交流专区

更多推荐