怎样定义方法暴露给JCEF(Chrominu内核)调用 #12525
Replies: 1 comment
-
记录下,只要把需要暴露的方法给window对象即可。 jcef调用直接 executeJavaScript("fnAlert('test');", "", 0); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Vue version
3.5.1
Link to minimal reproduction
无
Steps to reproduce
如果是 javascript,只要定义方法,直接可以被 jcef 的 executeJavaScript 调用。
function fnAlert(){....}
jcef调用:executeJavaScript('fnAlert();','',0)
但在vue3中,使用setup模式定义方法,在jcef中调用提示 Uncaught ReferenceError: fnAlert is not defined
vue3中定义
`
<script setup lang="ts"> function fnAlert(msg) { alert(msg); } defineExpose({ fnAlert, }); </script>`
在vue3中如何像javascript把方法暴露出来给chromium内核浏览器执行 executeJavaScript 来调用方法。
What is expected?
向浏览器暴露方法
What is actually happening?
...
System Info
No response
Any additional comments?
No response
Beta Was this translation helpful? Give feedback.
All reactions