zoukankan      html  css  js  c++  java
  • swagger2默认不展开/展开

    https://blog.csdn.net/fsdf8sad7/article/details/89478469

    当接口太多的时候,接口全部展开的时候访问会非常卡,点击一个接口也要卡很久。

    后来在地址栏上加一个参数就不会展开了。
    http://XXXXX/swagger2/index.html?docExpansion=none

    或者在swagger2的index.html资源文件配置一下docExpansion,就可以了。

    const ui = SwaggerUIBundle({
    url: window.location.origin + window.location.pathname.replace('/swagger2/index.html','') + "/v2/api-docs",//"/swagger.json",
    dom_id: '#swagger-ui',
    presets: [
    SwaggerUIBundle.presets.apis,
    SwaggerUIStandalonePreset
    ],
    plugins: [
    SwaggerUIBundle.plugins.DownloadUrl
    ],
    layout: "StandaloneLayout",
    docExpansion:"none"
    })
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    下面是docExpansion的解释:
    docExpansion: Controls the default expansion setting for the operations and tags. It can be ‘list’ (expands only the tags), ‘full’ (expands the tags and operations) or ‘none’ (expands nothing). The default is ‘list’.

    docExpansion:none(不展开) list(展开operations) full(全部展开)
    ————————————————
    版权声明:本文为CSDN博主「略。。。。」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/fsdf8sad7/article/details/89478469

  • 相关阅读:
    团队作业——系统设计
    团队作业—预则立&&他山之石
    Alpha 冲刺报告2
    Android:Date、String、Long三种日期类型之间的相互转换
    冲刺阶段第一天
    需求分析答辩总结
    用ExifInterface读取经纬度的时候遇到的一个问题
    项目uml设计
    项目选题报告答辩总结
    深夜睡不着,去某乎爬点照片
  • 原文地址:https://www.cnblogs.com/chinasoft/p/15787946.html
Copyright © 2011-2022 走看看