<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # dialog `dialog` 模塊提供了api來展示原生的系統對話框,例如打開文件框,alert框,所以web應用可以給用戶帶來跟系統應用相同的體驗. 對話框例子,展示了選擇文件和目錄: ```javascript var win = ...; // BrowserWindow in which to show the dialog const dialog = require('electron').dialog; console.log(dialog.showOpenDialog({ properties: [ 'openFile', 'openDirectory', 'multiSelections' ]})); ``` **OS X 上的注意事項**: 如果你想像sheets一樣展示對話框,只需要在`browserWindow` 參數中提供一個 `BrowserWindow` 的引用對象. ## 方法 `dialog` 模塊有以下方法: ### `dialog.showOpenDialog([browserWindow, ]options[, callback])` * `browserWindow` BrowserWindow (可選) * `options` Object * `title` String * `defaultPath` String * `filters` Array * `properties` Array - 包含了對話框的特性值, 可以包含 `openFile`, `openDirectory`, `multiSelections` and `createDirectory` * `callback` Function (可選) 成功使用這個方法的話,就返回一個可供用戶選擇的文件路徑數組,失敗返回 `undefined`. `filters` 當需要限定用戶的行為的時候,指定一個文件數組給用戶展示或選擇. 例如: ```javascript { filters: [ { name: 'Images', extensions: ['jpg', 'png', 'gif'] }, { name: 'Movies', extensions: ['mkv', 'avi', 'mp4'] }, { name: 'Custom File Type', extensions: ['as'] }, { name: 'All Files', extensions: ['*'] } ] } ``` `extensions` 數組應當只包含擴展名,不應該包含通配符或'.'號 (例如 `'png'` 正確,但是 `'.png'` 和 `'*.png'` 不正確). 展示全部文件的話, 使用 `'*'` 通配符 (不支持其他通配符). 如果 `callback` 被調用, 將異步調用 API ,并且結果將用過 `callback(filenames)` 展示. **注意:** 在 Windows 和 Linux ,一個打開的 dialog 不能既是文件選擇框又是目錄選擇框, 所以如果在這些平臺上設置 `properties` 的值為 `['openFile', 'openDirectory']` , 將展示一個目錄選擇框. ### `dialog.showSaveDialog([browserWindow, ]options[, callback])` * `browserWindow` BrowserWindow (可選) * `options` Object * `title` String * `defaultPath` String * `filters` Array * `callback` Function (可選) 成功使用這個方法的話,就返回一個可供用戶選擇的文件路徑數組,失敗返回 `undefined`. `filters` 指定展示一個文件類型數組, 例子 `dialog.showOpenDialog` . 如果 `callback` 被調用, 將異步調用 API ,并且結果將用過 `callback(filenames)` 展示. ### `dialog.showMessageBox([browserWindow, ]options[, callback])` * `browserWindow` BrowserWindow (可選) * `options` Object * `type` String - 可以是 `"none"`, `"info"`, `"error"`, `"question"` 或 `"warning"`. 在 Windows, "question" 與 "info" 展示圖標相同, 除非你使用 "icon" 參數. * `buttons` Array - buttons 內容,數組. * `defaultId` Integer - 在message box 對話框打開的時候,設置默認button選中,值為在 buttons 數組中的button索引. * `title` String - message box 的標題,一些平臺不顯示. * `message` String - message box 內容. * `detail` String - 額外信息. * `icon` [NativeImage](native-image.md) * `cancelId` Integer - 當用戶關閉對話框的時候,不是通過點擊對話框的button,就返回值.默認值為對應 "cancel" 或 "no" 標簽button 的索引值, 或者如果沒有這種button,就返回0. 在 OS X 和 Windows 上, "Cancel" button 的索引值將一直是 `cancelId`, 不管之前是不是特別指出的. * `noLink` Boolean - 在 Windows ,Electron 將嘗試識別哪個button 是普通 button (如 "Cancel" 或 "Yes"), 然后再對話框中以鏈接命令(command links)方式展現其它的 button . 這能讓對話框展示得很炫酷.如果你不喜歡這種效果,你可以設置 `noLink` 為 `true`. * `callback` Function 展示 message box, 它會阻塞進程,直到 message box 關閉為止.返回點擊按鈕的索引值. 如果 `callback` 被調用, 將異步調用 API ,并且結果將用過 `callback(response)` 展示. ### `dialog.showErrorBox(title, content)` 展示一個傳統的包含錯誤信息的對話框. 在 `app` 模塊觸發 `ready` 事件之前,這個 api 可以被安全調用,通常它被用來在啟動的早期階段報告錯誤. 在 Linux 上,如果在 `app` 模塊觸發 `ready` 事件之前調用,message 將會被觸發顯示stderr,并且沒有實際GUI 框顯示.
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看