【修复】vue-plugin-hiprint.js组件eval适配问题
This commit is contained in:
		
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										55930
									
								
								src/components/print/vue-plugin-hiprint.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55930
									
								
								src/components/print/vue-plugin-hiprint.js
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -125,15 +125,19 @@ const initWindow = () => { | |||||||
|   const transformCode = (codeStr) => { |   const transformCode = (codeStr) => { | ||||||
|     return transform(codeStr, { presets: ['env'] }).code |     return transform(codeStr, { presets: ['env'] }).code | ||||||
|   } |   } | ||||||
|   const interpreter = new Interpreter(window, { |  | ||||||
|     timeout: 1000, |  | ||||||
|   }) |  | ||||||
|  |  | ||||||
|   window.eval = code => { |  | ||||||
|     console.log(code) |  | ||||||
|     return interpreter.evaluate(transformCode(code)) |  | ||||||
|   } |  | ||||||
|   window.JsBarcode = JsBarcode |   window.JsBarcode = JsBarcode | ||||||
|  |   window.eval = (code, context) => { | ||||||
|  |     console.log(code) | ||||||
|  |     const interpreter = new Interpreter(context || window, { | ||||||
|  |       timeout: 1000, | ||||||
|  |     }) | ||||||
|  |     try { | ||||||
|  |       interpreter.evaluate(transformCode(code)) | ||||||
|  |     } catch (err) { | ||||||
|  |       console.log(err) | ||||||
|  |     } | ||||||
|  |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| export default { | export default { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user