当前位置: 首页 > news >正文

宁波住房和城乡建设网站制作网页链接

宁波住房和城乡建设网站,制作网页链接,js 捕获网站异常插件,展馆公司eel官方示例中暴露的js函数是全局函数,vue中的自定义函数作用域通常都是组件范围内。要让eel.js调用,需要将其升为全局可用。 一般方法有 app.config.globalProperties 或 mixin等。 main.js //main.jsimport { createApp } from vue import App from…

eel官方示例中暴露的js函数是全局函数,vue中的自定义函数作用域通常都是组件范围内。要让eel.js调用,需要将其升为全局可用。

一般方法有 app.config.globalProperties  或 mixin等。

main.js

//main.jsimport { createApp } from 'vue'
import App from './App.vue'const app = createApp(App);// 在 Vue 3 中添加全局属性(例如 `$eel`)
app.config.globalProperties.$eel = window.eel;app.mount('#app');

 App.vue

<template><img alt="Vue logo" src="./assets/vue.svg"> python eel + Vue3<HelloWorld />
</template><script>import HelloWorld from './components/HelloWorld.vue';export default {name: 'App',components: {HelloWorld}
}</script><style>
#app {text-align: center;margin-top: 60px;
}
</style>

HelloWorld.vue 

// HelloWorld.vue<script setup>//定义getCurrentInstance().appContext.config.globalProperties
import { ref, onMounted,getCurrentInstance } from 'vue'
const instance = getCurrentInstance();
const globalProperties = instance.appContext.config.globalProperties;// create a reactive count using ref
const count = ref(0)
const message = ref("Hello World!")const sayHelloByEEL = (x) => {globalProperties.$eel.say_hello_py(x + Math.floor(Math.random() * 101).toString())
}const sayHelloJS = (x) => {message.value = 'Say Hello From ' + Math.floor(Math.random() * 101).toString() +x;
}//使用 globalProperties 暴露sayHelloJS给Python (以say_hello_js为别名)
globalProperties.$eel.expose(sayHelloJS, 'say_hello_js')onMounted(() => {console.log(globalProperties)
})</script><template><p><button type="button" @click="count++">count is: {{ count }}</button></p><p><button @click="sayHelloByEEL('Javascript Button! ')">调用Python函数</button></p><p>{{ message }}</p><p><button @click="sayHelloJS(' JS Button!')">调用JS函数</button></p></template><style scoped></style>

http://www.yayakq.cn/news/925525/

相关文章:

  • 网站名称不能涉及中国企业网站模板
  • ASP网站建设实训报告总结衡水seo营销
  • 高端网站建设四川搜索排名优化策划
  • 图门市建设局网站photoshop下载手机版
  • 个人网站logo需要备案吗房屋在线设计工具
  • 购物网站设计说明wordpress添加直达链接
  • 网站建设工作室是干嘛的固安建站公司
  • 徐州网站二次开发校园网站建设的需求分析
  • 从化营销网站建设哪个网站做电子请帖好
  • 福建省住房和城乡建设厅门户网站佛山网站建设专家
  • com都有哪些网站珠海住建网站
  • 做图网站有哪些如何看网站有没有备案
  • 建网站保定最新免费网站源码
  • 西安有哪些做网站的公司好实用网站建设
  • 忻州网站建设网站推广wordpress不用ftp下载文件
  • 搜索公司信息的网站网站建设如何维护
  • 新手学做网站手机怎样做班级网站
  • 做最好的win7系统下载网站利用ionic做的网站
  • 可以做手机网页的网站南宁seo排名优化
  • 餐饮招商加盟网站建设费用wordpress工具
  • 怎样做阿里巴巴网站的店招seo做子网站
  • 网站模板下载之后如何修改备案 多个网站
  • 南京网站制作系统企业管理培训课程网课
  • 学校门户网站建设的意义腾讯体育
  • 大型门户网站设计唐河永琚建筑公司网站
  • 可视化建站网站源码泰安seo公司
  • 网站域名中文后缀appui设计图
  • 做网站筹钱需要多少钱网站建设维保合同
  • 江苏大都建设工程有限公司网站青岛网页搜索排名提升
  • 网站备案号查询网网上商城制作需要多少钱