首页 > 编程知识 正文

用html5开发本地桌面应用,vue怎么结合python登录

时间:2023-05-04 12:31:50 阅读:174889 作者:2983

python eel vue教程eel打包命令python-meel [ your _ main _ script ] [ your _ web _ folder ]

python -m eel main.py /web

El如何开发vue第一、结合启动文件importeelimportsysimportplatform“”的原理是:测试环境: 1、测试环境设置启动页面为vue的测试服务端口,aaportelimportsysimportplatform 绑定index.html中的eel.js 生产环境: 3360“”starteelwitheitherproductionordevelopmentconfiguration .“”if develop wargs=dict(mode=app,host='localhost ',port=9000,) else : directory=' web ' app=' chrome ' page=' indese size=) eel.init (目录) try:EEL.start (开始) page, **eel_kwargs ) exceptenvironmenterror 3360 # ifchromeisn ' t found fallbacktomicrosoftedgeonwin 10 orgreaterifsys.platform in ' win64']andint(platform.release )=10333666 mode='edge ',* * eel _ kwargs ] else : raise if _ name _==' '

2、在vue.config.js上配置:

(将导出目录设置为web。 如果不设置,eel可能无法调用web中的js。)

constpath=require('path ); module.exports={//map文件outputDir: './web'} 3、是否插入public/index.html :这一段非常重要

% if (process.env.node _ env==' production ' ) % script type=' text/JavaScript ' src='/eel.js '/script jation scriptscriptwindow.eel.set _ host (ws :0///localhost 336000/script % ) %三、使用方法参考eel使用教程##JS方面

1、用python声明方法,并用@eel.expose注释导出

import eel# 导出方法是JavaScript @ eel.exposedefsay _ hello _ py (x ) : ' ' printmessagefromjavascriptonappinitialization thencalllajization _hello_js ) python ) fromwithinsay_hello_py //调用方法windows.eel.[方法名称] windows.eel.say_hello_py

//声明方法functionsayhellojs(x ) console.log ) ' hellofrom'x ); //python//warn : mustusewindow.eeltokeepparse-able eel.expose { . } window.eel.expose (say hello js,' say imime 中选择另一种天花板类型)

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。