<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>

                ## 發布 對于發布來講,只需要將最終生成的靜態文件,也就是通常情況下`dist`文件夾的靜態文件發布到你的 cdn 或者靜態服務器即可,需要注意的是其中的`index.html`通常會是你后臺服務的入口頁面,在確定了 js 和 css 的靜態之后可能需要改變頁面的引入路徑。 ### 前端路由與服務端的結合 Ant Design Pro 使用的 Umi 支持兩種路由方式:`browserHistory`和`hashHistory`。 可以在`config/config.js`中進行配置選擇用哪個方式: ~~~ export default { history: 'hash', // 默認是 browser } ~~~ `hashHistory`使用如`https://cdn.com/#/users/123`這樣的 URL,取井號后面的字符作為路徑。`browserHistory`則直接使用`https://cdn.com/users/123`這樣的 URL。使用`hashHistory`時瀏覽器訪問到的始終都是根目錄下`index.html`。使用`browserHistory`則需要服務器做好處理 URL 的準備,處理應用啟動最初的`/`這樣的請求應該沒問題,但當用戶來回跳轉并在`/users/123`刷新時,服務器就會收到來自`/users/123`的請求,這時你需要配置服務器能處理這個 URL 返回正確的`index.html`。如果你能控制服務端,我們推薦使用`browserHistory`。 ### 使用 nginx nginx 作為最流行的 web 容器之一,配置和使用相當簡單,只要簡單的配置就能擁有高性能和高可用。推薦使用 nginx 托管。示例配置如下: ~~~ server { listen 80; # gzip config gzip on; gzip_min_length 1k; gzip_comp_level 9; gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png; gzip_vary on; gzip_disable "MSIE [1-6]\."; root /usr/share/nginx/html; location / { # 用于配合 browserHistory使用 try_files $uri $uri/ /index.html; # 如果有資源,建議使用 https + http2,配合按需加載可以獲得更好的體驗 # rewrite ^/(.*)$ https://preview.pro.ant.design/$1 permanent; } location /api { proxy_pass https://preview.pro.ant.design; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; } } server { # 如果有資源,建議使用 https + http2,配合按需加載可以獲得更好的體驗 listen 443 ssl http2 default_server; # 證書的公私鑰 ssl_certificate /path/to/public.crt; ssl_certificate_key /path/to/private.key; location / { # 用于配合 browserHistory使用 try_files $uri $uri/ /index.html; } location /api { proxy_pass https://preview.pro.ant.design; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; } } ~~~ ### 使用 spring boot Spring Boot 是使用最多的 java 框架,只需要簡單的幾步就可以與 Ant Design Pro 進行整合。 首先運行 build `$ npm run build` 然后將編譯之后的文件復制到 spring boot 項目的`/src/main/resources/static`目錄下。 重新啟動項目,訪問`http://localhost:8080/`就可以看到效果。 為了方便做整合,最好使用 hash 路由。如果你想使用 browserHistory ,你創建一個 controller ,并添加如下代碼: ~~~ @RequestMapping("/api/**") public ApiResult api(HttpServletRequest request, HttpServletResponse response){ return apiProxy.proxy(request, reponse); } @RequestMapping(value="/**", method=HTTPMethod.GET) public String index(){ return "index" } ~~~ > 注意 pro 并沒有提供 java 的 api 接口實現,如果只是為了預覽 demo,可以使用反向代理到`https://preview.pro.ant.design`。 ### 使用 express [express](http://expressjs.com/)的例子 ~~~ app.use(express.static(path.join(__dirname, 'build'))); app.get('/*', function (req, res) { res.sendFile(path.join(__dirname, 'build', 'index.html')); }); ~~~ ### 使用 egg [egg](https://eggjs.org/)的例子 ~~~ // controller exports.index = function* () { yield this.render('App.jsx', { context: { user: this.session.user, }, }); }; // router app.get('home', '/*', 'home.index'); ~~~ 關于路由更多可以參看[Umi 的路由文檔](https://umijs.org/zh/guide/router.html)。
                  <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>

                              哎呀哎呀视频在线观看