You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use new Window to create a new Windows form in JavaScript, the created form is blank. If I use WebviewWindow to create it, an error POST will be reported http://ipc.localhost/plugin%3Awebview%7Ccreate_webview_window 400 (Bad Request), I'm not sure if I missed something. Because I should have already configured the URL and src tauri/capabilities/main.json
When using WebviewWindow
When using Window
Reproduction
import{useState}from"react";importreactLogofrom"./assets/react.svg";import{invoke}from"@tauri-apps/api/core";import{WebviewWindow}from'@tauri-apps/api/webviewWindow'import{Window}from'@tauri-apps/api/Window'import"./App.css";functionApp(){const[greetMsg,setGreetMsg]=useState("");const[name,setName]=useState("");asyncfunctiongreet(){// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command//setGreetMsg(await invoke("greet", { name }));}functioncreate_windows(){constwebview=newWebviewWindow('my-label',{url: 'https://tauri.app/'});webview.once('tauri://created',function(){// webview successfully created});webview.once('tauri://error',function(e){// an error happened creating the webview});// const webview = new Window('my-label', {// url: 'https://tauri.app/'// });// webview.once('tauri://created', function () {// // webview successfully created// });// webview.once('tauri://error', function (e) {// // an error happened creating the webview// });}return(<divclassName="container"><h1>Welcome to Tauri!</h1><divclassName="row"><ahref="https://vitejs.dev"target="_blank"><imgsrc="/vite.svg"className="logo vite"alt="Vite logo"/></a><ahref="https://tauri.app"target="_blank"><imgsrc="/tauri.svg"className="logo tauri"alt="Tauri logo"/></a><ahref="https://reactjs.org"target="_blank"><imgsrc={reactLogo}className="logo react"alt="React logo"/></a></div><p>Click on the Tauri, Vite, and React logos to learn more.</p><formclassName="row"onSubmit={(e)=>{e.preventDefault();create_windows();}}><inputid="greet-input"onChange={(e)=>setName(e.currentTarget.value)}placeholder="Enter a name..."/><buttontype="submit">Greet</button></form><p>{greetMsg}</p></div>);}exportdefaultApp;
Thank you, but I have discovered a new issue,When I was about to create it for the second time, "WebviewWindow. getByLabel ('my label ');" returned as "null"
Describe the bug
When I use new Window to create a new Windows form in JavaScript, the created form is blank. If I use WebviewWindow to create it, an error POST will be reported
http://ipc.localhost/plugin%3Awebview%7Ccreate_webview_window 400 (Bad Request)
, I'm not sure if I missed something. Because I should have already configured the URL and src tauri/capabilities/main.jsonWhen using WebviewWindow
When using Window
Reproduction
src-tauri/capabilities/main.json
Expected behavior
I hope to be able to create a new sub window form normally on 2.0
Full
tauri info
outputStack trace
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: