You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
480 B
JavaScript
17 lines
480 B
JavaScript
10 months ago
|
//扩展window函数
|
||
|
window.recCodes = function recCodes(codes) {
|
||
|
if(codes){
|
||
|
if (!Array.isArray(codes) || codes.some(item => typeof item!== 'string')) {
|
||
|
throw new Error('codes 参数必须是一个字符串数组');
|
||
|
}
|
||
|
// 触发自定义事件
|
||
|
window.dispatchEvent(new CustomEvent('recCodes', {
|
||
|
detail: {
|
||
|
recCodes: codes
|
||
|
}
|
||
|
}));
|
||
|
}else{
|
||
|
alert("收到空数据");
|
||
|
}
|
||
|
|
||
|
}
|