import { Button, VerticalBox } from "std-widgets.slint"; export component MainWindow inherits Window { height: 180px; width: 320px; title: "VoileTftpTools"; default-font-family: "Segoe UI"; default-font-size: 16px; default-font-weight: 700; //选择路径回调 callback BrowserFolder() -> string; property SelectFolder: ""; //启动回调 callback StartTftp(); //停止回调 callback StopTftp(); //选择路径按钮 Rectangle { height: 35px; width: 95px; x: 10px; y: 10px; Button { height: parent.height; width: parent.width; text: "选择路径"; clicked => { SelectFolder = BrowserFolder(); } } } Rectangle { height: 35px; width: 95px; x: 110px; y: 10px; Button { height: parent.height; width: parent.width; text: "启动"; clicked => { StartTftp(); } } } Rectangle { height: 35px; width: 95px; x: 210px; y: 10px; Button { height: parent.height; width: parent.width; text: "停止"; clicked => { StopTftp(); } } } Text { x: 13px; y: 55px; text: "路径:"; } Text { x: 60px; y: 55px; width: 200px; wrap: word-wrap; // 自动换行关键属性 text: SelectFolder; } }