【修复】vue-plugin-hiprint.js组件eval适配问题

This commit is contained in:
yanran200830
2024-10-23 13:57:37 +08:00
parent f7530ed1f5
commit 9d7ed6f701
3 changed files with 56809 additions and 997 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -125,15 +125,19 @@ const initWindow = () => {
const transformCode = (codeStr) => {
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.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 {