中文 English

Swagger-UI adds project dependencies and modifies index.html

Published: 2021-02-06
swagger ui js index md5

swagger-bundle packaging

First enter the swagger-ui directory

npm install
npm run build

How to modify

The url in index.html is modified to:

and add functions

Screenshot Screenshot

url: "/v2/api-docs?group=" + getUrlParam("group"),
    function getUrlParam(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
        var r = window.location.search.substr(1).match(reg);  //匹配目标参数
        if (r != null) return unescape(r[2]);
        return ""; //返回参数值
    }