fes.js/api/index.html

164 lines
63 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>API参考 | Fes.js</title>
<meta name="generator" content="VuePress 1.5.4">
<meta name="description" content="中台应用前端快速解决方案">
<link rel="preload" href="/fes.js/assets/css/0.styles.54a65285.css" as="style"><link rel="preload" href="/fes.js/assets/js/app.d4a34833.js" as="script"><link rel="preload" href="/fes.js/assets/js/2.1380c702.js" as="script"><link rel="preload" href="/fes.js/assets/js/37.6bc69c79.js" as="script"><link rel="preload" href="/fes.js/assets/js/10.2329d47f.js" as="script"><link rel="prefetch" href="/fes.js/assets/js/100.c569829e.js"><link rel="prefetch" href="/fes.js/assets/js/101.4c4176fa.js"><link rel="prefetch" href="/fes.js/assets/js/102.ba7e3884.js"><link rel="prefetch" href="/fes.js/assets/js/103.ef62cdd7.js"><link rel="prefetch" href="/fes.js/assets/js/104.86034148.js"><link rel="prefetch" href="/fes.js/assets/js/105.3bb92ea5.js"><link rel="prefetch" href="/fes.js/assets/js/106.1df0d2ff.js"><link rel="prefetch" href="/fes.js/assets/js/107.b4c899e6.js"><link rel="prefetch" href="/fes.js/assets/js/108.5d6f1cb6.js"><link rel="prefetch" href="/fes.js/assets/js/109.3ed5c334.js"><link rel="prefetch" href="/fes.js/assets/js/11.f26621ac.js"><link rel="prefetch" href="/fes.js/assets/js/110.dce23dd6.js"><link rel="prefetch" href="/fes.js/assets/js/111.2476f0f8.js"><link rel="prefetch" href="/fes.js/assets/js/112.bd22c4d5.js"><link rel="prefetch" href="/fes.js/assets/js/113.ca15de1c.js"><link rel="prefetch" href="/fes.js/assets/js/114.957579ae.js"><link rel="prefetch" href="/fes.js/assets/js/115.024593d0.js"><link rel="prefetch" href="/fes.js/assets/js/116.d5cddf01.js"><link rel="prefetch" href="/fes.js/assets/js/117.046ca7d6.js"><link rel="prefetch" href="/fes.js/assets/js/118.11815117.js"><link rel="prefetch" href="/fes.js/assets/js/119.b20cef58.js"><link rel="prefetch" href="/fes.js/assets/js/12.85a9013e.js"><link rel="prefetch" href="/fes.js/assets/js/120.bcc0046b.js"><link rel="prefetch" href="/fes.js/assets/js/121.5670d1e6.js"><link rel="prefetch" href="/fes.js/assets/js/122.7a268c65.js"><link rel="prefetch" href="/fes.js/assets/js/123.91d512e1.js"><link rel="prefetch" href="/fes.js/assets/js/124.b184f22d.js"><link rel="prefetch" href="/fes.js/assets/js/125.2e43132d.js"><link rel="prefetch" href="/fes.js/assets/js/126.ee7d5e3d.js"><link rel="prefetch" href="/fes.js/assets/js/127.45531c4f.js"><link rel="prefetch" href="/fes.js/assets/js/128.32f0a2e5.js"><link rel="prefetch" href="/fes.js/assets/js/129.ef73662a.js"><link rel="prefetch" href="/fes.js/assets/js/13.15a3084c.js"><link rel="prefetch" href="/fes.js/assets/js/130.8df92d78.js"><link rel="prefetch" href="/fes.js/assets/js/131.f76b7077.js"><link rel="prefetch" href="/fes.js/assets/js/132.0af231cd.js"><link rel="prefetch" href="/fes.js/assets/js/133.d597ece5.js"><link rel="prefetch" href="/fes.js/assets/js/134.92e05e2b.js"><link rel="prefetch" href="/fes.js/assets/js/135.9fb556eb.js"><link rel="prefetch" href="/fes.js/assets/js/136.1f72abea.js"><link rel="prefetch" href="/fes.js/assets/js/137.56bccf1e.js"><link rel="prefetch" href="/fes.js/assets/js/138.5a51bcda.js"><link rel="prefetch" href="/fes.js/assets/js/139.b4c67904.js"><link rel="prefetch" href="/fes.js/assets/js/14.4deadb95.js"><link rel="prefetch" href="/fes.js/assets/js/140.cb5be1e8.js"><link rel="prefetch" href="/fes.js/assets/js/141.8ac7a23e.js"><link rel="prefetch" href="/fes.js/assets/js/142.18fed108.js"><link rel="prefetch" href="/fes.js/assets/js/143.770929a1.js"><link rel="prefetch" href="/fes.js/assets/js/144.6575df5c.js"><link rel="prefetch" href="/fes.js/assets/js/145.577f2f6b.js"><link rel="prefetch" href="/fes.js/assets/js/146.185eeeb6.js"><link rel="prefetch" href="/fes.js/assets/js/147.600622ee.js"><link rel="prefetch" href="/fes.js/assets/js/148.ed0ee1ce.js"><link rel="prefetch" href="/fes.js/assets/js/149.96e5521b.js"><link rel="prefetch" href="/fes.js/assets/js/15.43f80fe4.js"><link rel="prefetch" href="/fes.js/assets/js/150.7182a2d1.js"><link rel="prefetch" href="/fes.js/assets/js/151.026f2738.js"><link rel="prefetch" href="/fes.js/assets/js/152.a81d4dfe.js"><link rel="prefetch" href="/fes.js/assets/js/153.4b22b740.js"><link rel="prefetch" href="/fes.js/assets/js/154.772272fb.js"><link rel="prefetch" href="/fes.js/assets/js/155.92d8f811.js"><link rel="prefetch" href="/fes.js/assets/js/156.220bfbea.js"><link rel="prefetch" href="/fes.js/assets/js/157.8807b8cc.js"><link rel="prefetch" href="/fes.js/assets/js/158.3c945605.js"><link rel="prefetch" href="/fes.js/assets/js/159.3c226b1b.js"><link rel="prefetch" href="/fes.js/assets/js/16.21608533.js"><link rel="prefetch" href="/fes.js/assets/js/160.5e21b174.js"><link rel="prefetch" href="/fes.js/assets/js/161.585be5a8.js"><link rel="prefetch" href="/fes.js/assets/js/162.df94370a.js"><link rel="prefetch" href="/fes.js/assets/js/163.a72fddff.js"><link rel="prefetch" href="/fes.js/assets/js/164.a99e2d54.js"><link rel="prefetch" href="/fes.js/assets/js/165.1b64cb5a.js"><link rel="prefetch" href="/fes.js/assets/js/166.b864ebc8.js"><link rel="prefetch" href="/fes.js/assets/js/167.9f5457b2.js"><link rel="prefetch" href="/fes.js/assets/js/168.31c84839.js"><link rel="prefetch" href="/fes.js/assets/js/169.fd9ef1ad.js"><link rel="prefetch" href="/fes.js/assets/js/17.628e539d.js"><link rel="prefetch" href="/fes.js/assets/js/170.3fc4f24a.js"><link rel="prefetch" href="/fes.js/assets/js/171.2c85e346.js"><link rel="prefetch" href="/fes.js/assets/js/172.811f8353.js"><link rel="prefetch" href="/fes.js/assets/js/173.da8fc25b.js"><link rel="prefetch" href="/fes.js/assets/js/174.a10e3d95.js"><link rel="prefetch" href="/fes.js/assets/js/175.5b6b9f95.js"><link rel="prefetch" href="/fes.js/assets/js/176.9ae11d97.js"><link rel="prefetch" href="/fes.js/assets/js/177.263c7c05.js"><link rel="prefetch" href="/fes.js/assets/js/178.8af820ff.js"><link rel="prefetch" href="/fes.js/assets/js/179.340f2124.js"><link rel="prefetch" href="/fes.js/assets/js/18.f74c470d.js"><link rel="prefetch" href="/fes.js/assets/js/180.1721f39e.js"><link rel="prefetch" href="/fes.js/assets/js/181.362ec251.js"><link rel="prefetch" href="/fes.js/assets/js/182.8be6f10c.js"><link rel="prefetch" href="/fes.js/assets/js/183.e0094e6b.js"><link rel="prefetch" href="/fes.js/assets/js/184.4ded5010.js"><link rel="prefetch" href="/fes.js/assets/js/185.ecfa04cc.js"><link rel="prefetch" href="/fes.js/assets/js/186.d85e6338.js"><link rel="prefetch" href="/fes.js/assets/js/187.45ee0ff9.js"><link rel="prefetch" href="/fes.js/assets/js/188.455e3ba7.js"><link rel="prefetch" href="/fes.js/assets/js/189.99089212.js"><link rel="prefetch" href="/fes.js/assets/js/19.adb191bd.js"><link rel="prefetch" href="/fes.js/assets/js/190.8db6e175.js"><link rel="prefetch" href="/fes.js/assets/js/191.58e5c5e5.js"><link rel="prefetch" href="/fes.js/assets/js/20.3c4a8246.js"><link rel="prefetch" href="/fes.js/assets/js/21.bceab9c1.js"><link rel="prefetch" href="/fes.js/assets/js/22.b9c001d7.js"><link rel="prefetch" href="/fes.js/assets/js/23.c3c204bd.js"><link rel="prefetch" href="/fes.js/assets/js/24.727208d4.js"><link rel="prefetch" href="/fes.js/assets/js/25.90ae11fd.js"><link rel="prefetch" href="/fes.js/assets/js/26.30023c0d.js"><link rel="prefetch" href="/fes.js/assets/js/27.81a4b14d.js"><link rel="prefetch" href="/fes.js/assets/js/28.57f73fbb.js"><link rel="prefetch" href="/fes.js/assets/js/29.fd64021e.js"><link rel="prefetch" href="/fes.js/assets/js/3.5e11613d.js"><link rel="prefetch" href="/fes.js/assets/js/30.76efdf4f.js"><link rel="prefetch" href="/fes.js/assets/js/31.e869900c.js"><link rel="prefetch" href="/fes.js/assets/js/32.b2e26eb6.js"><link rel="prefetch" href="/fes.js/assets/js/33.747fbc03.js"><link rel="prefetch" href="/fes.js/assets/js/34.de9ee359.js"><link rel="prefetch" href="/fes.js/assets/js/35.fec8dc48.js"><link rel="prefetch" href="/fes.js/assets/js/36.3bc574d9.js"><link rel="prefetch" href="/fes.js/assets/js/38.58d126e9.js"><link rel="prefetch" href="/fes.js/assets/js/39.c5630ef0.js"><link rel="prefetch" href="/fes.js/assets/js/4.8aad18e1.js"><link rel="prefetch" href="/fes.js/assets/js/40.b0d45bd4.js"><link rel="prefetch" href="/fes.js/assets/js/41.5389b6cf.js"><link rel="prefetch" href="/fes.js/assets/js/42.08a733d0.js"><link rel="prefetch" href="/fes.js/assets/js/43.faa7983a.js"><link rel="prefetch" href="/fes.js/assets/js/44.b9392e16.js"><link rel="prefetch" href="/fes.js/assets/js/45.c8f02fd6.js"><link rel="prefetch" href="/fes.js/assets/js/46.70c14108.js"><link rel="prefetch" href="/fes.js/assets/js/47.be381f75.js"><link rel="prefetch" href="/fes.js/assets/js/48.23b5f25e.js"><link rel="prefetch" href="/fes.js/assets/js/49.c8f41428.js"><link rel="prefetch" href="/fes.js/assets/js/5.ef7cb79c.js"><link rel="prefetch" href="/fes.js/assets/js/50.6b3a205c.js"><link rel="prefetch" href="/fes.js/assets/js/51.952169d3.js"><link rel="prefetch" href="/fes.js/assets/js/52.aa7f7958.js"><link rel="prefetch" href="/fes.js/assets/js/53.0c06e959.js"><link rel="prefetch" href="/fes.js/assets/js/54.7c361990.js"><link rel="prefetch" href="/fes.js/assets/js/55.fc8c73f5.js"><link rel="prefetch" href="/fes.js/assets/js/56.9f4b303c.js"><link rel="prefetch" href="/fes.js/assets/js/57.5750a64c.js"><link rel="prefetch" href="/fes.js/assets/js/58.fafee21e.js"><link rel="prefetch" href="/fes.js/assets/js/59.d3c586c7.js"><link rel="prefetch" href="/fes.js/assets/js/6.1f8c31c8.js"><link rel="prefetch" href="/fes.js/assets/js/60.6b493d4c.js"><link rel="prefetch" href="/fes.js/assets/js/61.6d4baf8a.js"><link rel="prefetch" href="/fes.js/assets/js/62.7a25fd87.js"><link rel="prefetch" href="/fes.js/assets/js/63.5e270828.js"><link rel="prefetch" href="/fes.js/assets/js/64.b17abb2c.js"><link rel="prefetch" href="/fes.js/assets/js/65.ecb4d044.js"><link rel="prefetch" href="/fes.js/assets/js/66.214baade.js"><link rel="prefetch" href="/fes.js/assets/js/67.e98811c2.js"><link rel="prefetch" href="/fes.js/assets/js/68.0b88d471.js"><link rel="prefetch" href="/fes.js/assets/js/69.37a9f9dc.js"><link rel="prefetch" href="/fes.js/assets/js/7.154f06b1.js"><link rel="prefetch" href="/fes.js/assets/js/70.b9276e8b.js"><link rel="prefetch" href="/fes.js/assets/js/71.ec413e60.js"><link rel="prefetch" href="/fes.js/assets/js/72.9b78f34a.js"><link rel="prefetch" href="/fes.js/assets/js/73.5cc116e1.js"><link rel="prefetch" href="/fes.js/assets/js/74.ed3f9134.js"><link rel="prefetch" href="/fes.js/assets/js/75.0ac19e88.js"><link rel="prefetch" href="/fes.js/assets/js/76.8fe79f15.js"><link rel="prefetch" href="/fes.js/assets/js/77.011411bc.js"><link rel="prefetch" href="/fes.js/assets/js/78.932d3724.js"><link rel="prefetch" href="/fes.js/assets/js/79.e5e592c9.js"><link rel="prefetch" href="/fes.js/assets/js/8.6a1e4d2c.js"><link rel="prefetch" href="/fes.js/assets/js/80.87be71a6.js"><link rel="prefetch" href="/fes.js/assets/js/81.55e1c975.js"><link rel="prefetch" href="/fes.js/assets/js/82.ab36fade.js"><link rel="prefetch" href="/fes.js/assets/js/83.14cd3a8f.js"><link rel="prefetch" href="/fes.js/assets/js/84.f413793b.js"><link rel="prefetch" href="/fes.js/assets/js/85.cf1d54c8.js"><link rel="prefetch" href="/fes.js/assets/js/86.9867ea44.js"><link rel="prefetch" href="/fes.js/assets/js/87.7d9d9c02.js"><link rel="prefetch" href="/fes.js/assets/js/88.1fb3748f.js"><link rel="prefetch" href="/fes.js/assets/js/89.c338aa8d.js"><link rel="prefetch" href="/fes.js/assets/js/9.fc7e7822.js"><link rel="prefetch" href="/fes.js/assets/js/90.5aa004be.js"><link rel="prefetch" href="/fes.js/assets/js/91.52c4697f.js"><link rel="prefetch" href="/fes.js/assets/js/92.876ffbbe.js"><link rel="prefetch" href="/fes.js/assets/js/93.0fc5d2e3.js"><link rel="prefetch" href="/fes.js/assets/js/94.159fad62.js"><link rel="prefetch" href="/fes.js/assets/js/95.a7ba2e4a.js"><link rel="prefetch" href="/fes.js/assets/js/96.7e1c7796.js"><link rel="prefetch" href="/fes.js/assets/js/97.171b9202.js"><link rel="prefetch" href="/fes.js/assets/js/98.13a9a6a3.js"><link rel="prefetch" href="/fes.js/assets/js/99.81556285.js">
<link rel="stylesheet" href="/fes.js/assets/css/0.styles.54a65285.css">
</head>
<body>
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/fes.js/" class="home-link router-link-active"><!----> <span class="site-name">Fes.js</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/fes.js/guide/" class="nav-link">
指南
</a></div><div class="nav-item"><a href="/fes.js/api/" aria-current="page" class="nav-link router-link-exact-active router-link-active">
API参考
</a></div><div class="nav-item"><a href="/fes.js/ui/" class="nav-link">
组件
</a></div><div class="nav-item"><a href="/fes.js/cli/" class="nav-link">
CLI
</a></div> <a href="https://github.com/WeBankFinTech/fes.js" target="_blank" rel="noopener noreferrer" class="repo-link">
GitHub
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/fes.js/guide/" class="nav-link">
指南
</a></div><div class="nav-item"><a href="/fes.js/api/" aria-current="page" class="nav-link router-link-exact-active router-link-active">
API参考
</a></div><div class="nav-item"><a href="/fes.js/ui/" class="nav-link">
组件
</a></div><div class="nav-item"><a href="/fes.js/cli/" class="nav-link">
CLI
</a></div> <a href="https://github.com/WeBankFinTech/fes.js" target="_blank" rel="noopener noreferrer" class="repo-link">
GitHub
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></nav> <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>API参考</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/fes.js/api/#fesapp" class="sidebar-link">FesApp</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/fes.js/api/#addthrid" class="sidebar-link">addThrid</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#adddirective" class="sidebar-link">addDirective</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#addcomponent" class="sidebar-link">addComponent</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#addfilter" class="sidebar-link">addFilter</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#get" class="sidebar-link">get</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#set" class="sidebar-link">set</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#setrole" class="sidebar-link">setRole</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#setallowpage" class="sidebar-link">setAllowPage</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#getallowpageasync" class="sidebar-link">getAllowPageAsync</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#setlocale" class="sidebar-link">setLocale</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#setfavicon" class="sidebar-link">setFavicon</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#router" class="sidebar-link">router</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#setbeforerouter" class="sidebar-link">setBeforeRouter</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#setafterrouter" class="sidebar-link">setAfterRouter</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#events" class="sidebar-link">events</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#fes-logo-click" class="sidebar-link">feslogoclick</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#fesenv" class="sidebar-link">FesEnv</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#fesstorage" class="sidebar-link">FesStorage</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#fesmap" class="sidebar-link">FesMap</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#fesutil" class="sidebar-link">FesUtil</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#fesapi" class="sidebar-link">FesApi</a></li></ul></li><li><a href="/fes.js/api/#fesapi-2" class="sidebar-link">FesApi</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/fes.js/api/#fetch" class="sidebar-link">fetch</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#option" class="sidebar-link">option</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#setheader" class="sidebar-link">setHeader</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#seterror" class="sidebar-link">setError</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#setresponse" class="sidebar-link">setResponse</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#setimportant" class="sidebar-link">setImportant</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#setreqinterceptor-ejectreqinterceptor" class="sidebar-link">setReqInterceptor &amp; ejectReqInterceptor</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#setresinterceptor-ejectresinterceptor" class="sidebar-link">setResInterceptor &amp; ejectResInterceptor</a></li></ul></li><li><a href="/fes.js/api/#fesfesx" class="sidebar-link">FesFesx</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/fes.js/api/#get-2" class="sidebar-link">get</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#set-2" class="sidebar-link">set</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#clear" class="sidebar-link">clear</a></li></ul></li><li><a href="/fes.js/api/#fesmap-2" class="sidebar-link">FesMap</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/fes.js/api/#getvaluebyname" class="sidebar-link">getValueByName</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#getnamebyvalue" class="sidebar-link">getNameByValue</a></li></ul></li><li><a href="/fes.js/api/#fesenv-2" class="sidebar-link">FesEnv</a><ul class="sidebar-sub-headers"></ul></li><li><a href="/fes.js/api/#fesstorage-2" class="sidebar-link">FesStorage</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/fes.js/api/#set-3" class="sidebar-link">set</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#get-3" class="sidebar-link">get</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#clear-2" class="sidebar-link">clear</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#remove" class="sidebar-link">remove</a></li></ul></li><li><a href="/fes.js/api/#fesutil-2" class="sidebar-link">FesUtil</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/fes.js/api/#getclass" class="sidebar-link">getClass</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#hasclass" class="sidebar-link">hasClass</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#setclass" class="sidebar-link">setClass</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#addclass" class="sidebar-link">addClass</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#removeclass" class="sidebar-link">removeClass</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#contains" class="sidebar-link">contains</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#isplainobject" class="sidebar-link">isPlainObject</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#isobject" class="sidebar-link">isObject</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#isnumber" class="sidebar-link">isNumber</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#isdate" class="sidebar-link">isDate</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#isfunction" class="sidebar-link">isFunction</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#isarray" class="sidebar-link">isArray</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#isstring" class="sidebar-link">isString</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#isnull" class="sidebar-link">isNull</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#event-on" class="sidebar-link">event.on</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#event-one" class="sidebar-link">event.one</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#event-off" class="sidebar-link">event.off</a></li><li class="sidebar-sub-header"><a href="/fes.js/api/#event-trigger" class="sidebar-link">event.trigger</a></li></ul></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h2 id="fesapp"><a href="#fesapp" class="header-anchor">#</a> FesApp</h2> <h3 id="addthrid"><a href="#addthrid" class="header-anchor">#</a> addThrid</h3> <p>添加Vue的插件</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesApp<span class="token punctuation">.</span><span class="token function">addThrid</span><span class="token punctuation">(</span>name<span class="token punctuation">,</span> options<span class="token punctuation">)</span>
</code></pre></div><h3 id="adddirective"><a href="#adddirective" class="header-anchor">#</a> addDirective</h3> <p>添加全局插件</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesApp<span class="token punctuation">.</span><span class="token function">addDirective</span><span class="token punctuation">(</span>name<span class="token punctuation">,</span> options<span class="token punctuation">)</span>
</code></pre></div><h3 id="addcomponent"><a href="#addcomponent" class="header-anchor">#</a> addComponent</h3> <p>添加全局组件</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesApp<span class="token punctuation">.</span><span class="token function">addComponent</span><span class="token punctuation">(</span>name<span class="token punctuation">,</span> component<span class="token punctuation">)</span>
</code></pre></div><h3 id="addfilter"><a href="#addfilter" class="header-anchor">#</a> addFilter</h3> <p>添加全局过滤器</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesApp<span class="token punctuation">.</span><span class="token function">addFilter</span><span class="token punctuation">(</span>name<span class="token punctuation">,</span> func<span class="token punctuation">)</span>
</code></pre></div><h3 id="get"><a href="#get" class="header-anchor">#</a> get</h3> <p>从内部的状态容器<code>_fesx</code>中获取值</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesApp<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span>key<span class="token punctuation">)</span>
</code></pre></div><h3 id="set"><a href="#set" class="header-anchor">#</a> set</h3> <p>把内容保存到内部的状态容器<code>_fesx</code></p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesApp<span class="token punctuation">.</span><span class="token function">set</span><span class="token punctuation">(</span>key<span class="token punctuation">,</span> value<span class="token punctuation">)</span>
</code></pre></div><h3 id="setrole"><a href="#setrole" class="header-anchor">#</a> setRole</h3> <p>设置角色<br> <code>roleId</code>角色的id<br> <code>redirect</code> 设置角色后是否跳转到角色所属资源地址的第一个默认为true<br> <code>update</code><code>redirect</code>为true跳转后是否使用当前路由默认为true</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesApp<span class="token punctuation">.</span><span class="token function">setRole</span><span class="token punctuation">(</span>roleId<span class="token punctuation">,</span> redirect<span class="token punctuation">,</span> update<span class="token punctuation">)</span>
</code></pre></div><h3 id="setallowpage"><a href="#setallowpage" class="header-anchor">#</a> setAllowPage</h3> <p>设置当前用户可访问的资源列表<br> <code>urls</code>用户可访问的资源列表<br> <code>redirect</code>设置角色后是否跳转到角色所属资源地址的第一个默认为true<br> <code>update</code><code>redirect</code>为true跳转后是否使用当前路由默认为true</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesApp<span class="token punctuation">.</span><span class="token function">setAllowPage</span><span class="token punctuation">(</span>urls<span class="token punctuation">,</span> redirect<span class="token punctuation">,</span> update<span class="token punctuation">)</span>
</code></pre></div><h3 id="getallowpageasync"><a href="#getallowpageasync" class="header-anchor">#</a> getAllowPageAsync</h3> <p>获取当前用户的可访问资源列表</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesApp<span class="token punctuation">.</span><span class="token function">getAllowPageAsync</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
</code></pre></div><h3 id="setlocale"><a href="#setlocale" class="header-anchor">#</a> setLocale</h3> <p>更改当前的语言选项</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesApp<span class="token punctuation">.</span><span class="token function">setLocale</span><span class="token punctuation">(</span><span class="token string">'en'</span><span class="token punctuation">)</span>
</code></pre></div><h3 id="setfavicon"><a href="#setfavicon" class="header-anchor">#</a> setFavicon</h3> <p>设置当前应用的Favicon</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesApp<span class="token punctuation">.</span><span class="token function">setLocale</span><span class="token punctuation">(</span>url<span class="token punctuation">)</span>
</code></pre></div><h3 id="router"><a href="#router" class="header-anchor">#</a> router</h3> <p>Vue Router的实例具体API请参考<a href="https://router.vuejs.org/zh/api/#router-%E5%AE%9E%E4%BE%8B%E6%96%B9%E6%B3%95" target="_blank" rel="noopener noreferrer">router-实例方法<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></p> <h3 id="setbeforerouter"><a href="#setbeforerouter" class="header-anchor">#</a> setBeforeRouter</h3> <p>路由跳转前的事件钩子,执行<code>next()</code>动作跳转路由,执行<code>next(false)</code>阻止跳转。</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesApp<span class="token punctuation">.</span><span class="token function">setBeforeRouter</span><span class="token punctuation">(</span><span class="token keyword">function</span> <span class="token punctuation">(</span><span class="token parameter">to<span class="token punctuation">,</span> <span class="token keyword">from</span><span class="token punctuation">,</span> next</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
<span class="token function">next</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre></div><h3 id="setafterrouter"><a href="#setafterrouter" class="header-anchor">#</a> setAfterRouter</h3> <p>路由跳转后的事件钩子</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesApp<span class="token punctuation">.</span><span class="token function">setAfterRouter</span><span class="token punctuation">(</span><span class="token keyword">function</span> <span class="token punctuation">(</span><span class="token parameter">route</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">&quot;您浏览到了&quot;</span><span class="token operator">+</span>route<span class="token punctuation">.</span>path<span class="token punctuation">)</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre></div><h3 id="events"><a href="#events" class="header-anchor">#</a> events</h3> <p>FesApp触发的事件</p> <h4 id="fes-logout"><a href="#fes-logout" class="header-anchor">#</a> fes_logout</h4> <p>当点击系统默认退出按钮时在FesApp上触发<code>fes_logout</code>事件。可以在退出事件里面执行清除逻辑。</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesApp<span class="token punctuation">.</span><span class="token function">on</span><span class="token punctuation">(</span><span class="token string">'fes_logout'</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token parameter">FesAppInstance</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>
</code></pre></div><h3 id="fes-logo-click"><a href="#fes-logo-click" class="header-anchor">#</a> fes_logo_click</h3> <p>点击logo时触发</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesApp<span class="token punctuation">.</span><span class="token function">on</span><span class="token punctuation">(</span><span class="token string">'fes_logo_click'</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token parameter">FesAppInstance</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>
</code></pre></div><h3 id="fesenv"><a href="#fesenv" class="header-anchor">#</a> FesEnv</h3> <p>FesEnv的引用具体Api请参考<a href="/fes.js/api/#fesenv">api-FesEnv</a></p> <h3 id="fesstorage"><a href="#fesstorage" class="header-anchor">#</a> FesStorage</h3> <p>FesStorage的引用具体Api请参考<a href="/fes.js/api/#fesstorage">api-FesStorage</a></p> <h3 id="fesmap"><a href="#fesmap" class="header-anchor">#</a> FesMap</h3> <p>FesMap的引用具体Api请参考<a href="/fes.js/api/#fesmap">api-FesMap</a></p> <h3 id="fesutil"><a href="#fesutil" class="header-anchor">#</a> FesUtil</h3> <p>FesUtil的引用具体Api请参考<a href="/fes.js/api/#fesutil">api-FesUtil</a></p> <h3 id="fesapi"><a href="#fesapi" class="header-anchor">#</a> FesApi</h3> <p>FesApi的引用具体Api请参考<a href="/fes.js/api/#fesapi">api-FesApi</a></p> <h2 id="fesapi-2"><a href="#fesapi-2" class="header-anchor">#</a> FesApi</h2> <h3 id="fetch"><a href="#fetch" class="header-anchor">#</a> fetch</h3> <p><strong>fetch(url, data, option)</strong><br> <code>url</code>为接口的请求路径,必填<br> <code>data</code>是请求参数,可选<br> <code>option</code>是请求配置,可选,具体配置可参考<a href="https://github.com/axios/axios" target="_blank" rel="noopener noreferrer">axios<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a><br>
默认调用post请求返回promise对象可以通过 option 方法更改默认的 method。</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesApi<span class="token punctuation">.</span><span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">&quot;/post&quot;</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">rst</span><span class="token operator">=&gt;</span><span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token comment">// post + 传参数</span>
<span class="token keyword">this</span><span class="token punctuation">.</span>FesApi<span class="token punctuation">.</span><span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">&quot;/post&quot;</span><span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">rst</span><span class="token operator">=&gt;</span><span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token comment">// get + 传参数</span>
<span class="token keyword">this</span><span class="token punctuation">.</span>FesApi<span class="token punctuation">.</span><span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">&quot;/get&quot;</span><span class="token punctuation">,</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token string">'get'</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">rst</span><span class="token operator">=&gt;</span><span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token comment">// post + 传参数 + 设置button请求中不能点击</span>
<span class="token keyword">this</span><span class="token punctuation">.</span>FesApi<span class="token punctuation">.</span><span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">&quot;/post&quot;</span><span class="token punctuation">,</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>
method<span class="token operator">:</span> <span class="token string">'post'</span><span class="token punctuation">,</span>
button<span class="token operator">:</span> button <span class="token comment">// 如果配置此项则button在响应回来之前不能继续被点击</span>
<span class="token punctuation">}</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">rst</span><span class="token operator">=&gt;</span><span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span>
</code></pre></div><h3 id="option"><a href="#option" class="header-anchor">#</a> option</h3> <p><strong>option(option)</strong><br>
配置ajax请求参数</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesApi<span class="token punctuation">.</span><span class="token function">option</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
baseURL<span class="token operator">:</span> <span class="token string">&quot;http://l.sit.webank.io/pmbank-wpadm/product&quot;</span> <span class="token comment">// baseURL默认为 this.FesEnv.api</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre></div><h3 id="setheader"><a href="#setheader" class="header-anchor">#</a> setHeader</h3> <p><strong>setHeader(headers)</strong>
设置请求头,支持为 delete, get, head, post, put, patch 等特定方法设置特定的请求头</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesApi<span class="token punctuation">.</span><span class="token function">setHeader</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
<span class="token string">'Accept'</span><span class="token operator">:</span> <span class="token string">'text/html'</span><span class="token punctuation">,</span> <span class="token comment">// 所有请求都会生效</span>
post<span class="token operator">:</span> <span class="token punctuation">{</span>
<span class="token string">'Content-Type'</span><span class="token operator">:</span> <span class="token string">'application/json'</span> <span class="token comment">// 只有 post 请求生效</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>
</code></pre></div><h3 id="seterror"><a href="#seterror" class="header-anchor">#</a> setError</h3> <p><strong>setError(errors)</strong><br>
只有状态码为200而且业务状态码为成功的情况下才算成功其他情况都判断为失败。如果设置了错误码配置则不自动提示错误消息回调函数的参数为response。</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesApi<span class="token punctuation">.</span><span class="token function">setError</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
<span class="token number">401</span><span class="token operator">:</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token parameter">response</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>response<span class="token punctuation">)</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token number">10080</span><span class="token operator">:</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token parameter">response</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>response<span class="token punctuation">)</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>
</code></pre></div><h3 id="setresponse"><a href="#setresponse" class="header-anchor">#</a> setResponse</h3> <p><strong>setResponse(constructionOfResponse)</strong><br>
响应一般会由状态码、错误消息、数据组成。我们设置好接口的响应体的数据结构之后FES就能直接拿到错误码和业务数据。<br>
解析resultPath拿到的业务参数会作为then函数的第一个参数。如果resultPath是<code>*</code>则结果是响应的全部内容</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token comment">//设置响应结构</span>
<span class="token keyword">this</span><span class="token punctuation">.</span>FesApi<span class="token punctuation">.</span><span class="token function">setResponse</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
successCode <span class="token operator">:</span> <span class="token string">&quot;0&quot;</span><span class="token punctuation">,</span>
codePath <span class="token operator">:</span> <span class="token string">&quot;code&quot;</span><span class="token punctuation">,</span>
messagePath <span class="token operator">:</span> <span class="token string">&quot;msg&quot;</span><span class="token punctuation">,</span>
resultPath <span class="token operator">:</span> <span class="token string">&quot;result&quot;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre></div><p>也可以对单独的接口设置响应结构:</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesApi<span class="token punctuation">.</span><span class="token function">fetch</span><span class="token punctuation">(</span><span class="token string">&quot;/query&quot;</span><span class="token punctuation">,</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>
resultFormat<span class="token operator">:</span> <span class="token punctuation">{</span>
successCode <span class="token operator">:</span> <span class="token string">&quot;0&quot;</span><span class="token punctuation">,</span>
codePath <span class="token operator">:</span> <span class="token string">&quot;code&quot;</span><span class="token punctuation">,</span>
messagePath <span class="token operator">:</span> <span class="token string">&quot;msg&quot;</span><span class="token punctuation">,</span>
resultPath <span class="token operator">:</span> <span class="token string">&quot;result&quot;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">rst</span><span class="token operator">=&gt;</span><span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span>
</code></pre></div><h3 id="setimportant"><a href="#setimportant" class="header-anchor">#</a> setImportant</h3> <p><strong>setImportant(important)</strong><br>
设置那些URL是非常重要的不能在短时间内重复发起的。在访问这些URL时给予提示是否继续下去。</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesApi<span class="token punctuation">.</span><span class="token function">setImportant</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
<span class="token string">'generalcard/action'</span><span class="token operator">:</span> <span class="token punctuation">{</span>
control<span class="token operator">:</span> <span class="token number">10000</span><span class="token punctuation">,</span>
message<span class="token operator">:</span> <span class="token string">'您在十秒内重复发起手工清算操作,是否继续?'</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>
</code></pre></div><h3 id="setreqinterceptor-ejectreqinterceptor"><a href="#setreqinterceptor-ejectreqinterceptor" class="header-anchor">#</a> setReqInterceptor &amp; ejectReqInterceptor</h3> <p>请求拦截器和取消请求拦截,兼容<code>axios</code>拦截器的设置方法</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token comment">// 参数支持: function, [function, function]</span>
<span class="token comment">// 请求拦截</span>
<span class="token keyword">const</span> eject <span class="token operator">=</span> api<span class="token punctuation">.</span><span class="token function">setReqInterceptor</span><span class="token punctuation">(</span><span class="token keyword">function</span> <span class="token punctuation">(</span><span class="token parameter">config</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
<span class="token comment">// do something</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token comment">// 取消请求拦截</span>
api<span class="token punctuation">.</span><span class="token function">ejectReqInterceptor</span><span class="token punctuation">(</span>eject<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre></div><h3 id="setresinterceptor-ejectresinterceptor"><a href="#setresinterceptor-ejectresinterceptor" class="header-anchor">#</a> setResInterceptor &amp; ejectResInterceptor</h3> <p>响应拦截器和取消响应拦截,兼容<code>axios</code>拦截器的设置方法</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token comment">// 参数支持: function, [function, function]</span>
<span class="token comment">// 响应拦截</span>
<span class="token keyword">const</span> eject <span class="token operator">=</span> api<span class="token punctuation">.</span><span class="token function">setResInterceptor</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token parameter">response</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
<span class="token comment">// do something</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token parameter">error</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
<span class="token comment">// do somthing for error</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token comment">// 取消响应拦截</span>
api<span class="token punctuation">.</span><span class="token function">ejectResInterceptor</span><span class="token punctuation">(</span>eject<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre></div><h2 id="fesfesx"><a href="#fesfesx" class="header-anchor">#</a> FesFesx</h2> <p>FesFesx是全局状态容器独立于组件之外的一个Map对象。储存在FesFesx中的数据也会存储在FesStroage中当刷新页面时会恢复刷新前的状态。</p> <h3 id="get-2"><a href="#get-2" class="header-anchor">#</a> get</h3> <p>通过<code>key</code>获取值</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesFesx<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span>key<span class="token punctuation">)</span>
</code></pre></div><p>其实也可以通过<code>this.FesFesx[key]</code>获取值</p> <h3 id="set-2"><a href="#set-2" class="header-anchor">#</a> set</h3> <p>设置<code>key</code>的值<code>value</code>,调用<code>set</code>方法设置的<code>key</code>是响应式的。</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesFesx<span class="token punctuation">.</span><span class="token function">set</span><span class="token punctuation">(</span>key<span class="token punctuation">,</span> value<span class="token punctuation">)</span>
</code></pre></div><h3 id="clear"><a href="#clear" class="header-anchor">#</a> clear</h3> <p>清除所有状态</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesFesx<span class="token punctuation">.</span><span class="token function">clear</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
</code></pre></div><h2 id="fesmap-2"><a href="#fesmap-2" class="header-anchor">#</a> FesMap</h2> <h3 id="getvaluebyname"><a href="#getvaluebyname" class="header-anchor">#</a> getValueByName</h3> <p>通过描述获取值<br> <code>item</code>表示数据字典项的名称<br> <code>name</code>表示<code>item</code>数据字典项中某项的描述</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesMap<span class="token punctuation">.</span><span class="token function">getValueByName</span><span class="token punctuation">(</span>item<span class="token punctuation">,</span> name<span class="token punctuation">)</span>
</code></pre></div><h3 id="getnamebyvalue"><a href="#getnamebyvalue" class="header-anchor">#</a> getNameByValue</h3> <p>通过值获取值的描述<br> <code>item</code>表示数据字典项的名称<br> <code>value</code>表示<code>item</code>数据字典项中某项的值</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesMap<span class="token punctuation">.</span><span class="token function">getNameByValue</span><span class="token punctuation">(</span>item<span class="token punctuation">,</span> value<span class="token punctuation">)</span>
</code></pre></div><h2 id="fesenv-2"><a href="#fesenv-2" class="header-anchor">#</a> FesEnv</h2> <p>在 fes.config.js 中配置的环境变量可以通过 FesEnv 获取。</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token comment">// xxx为环境变量也就是运行参数中的 --env=xxx</span>
<span class="token keyword">this</span><span class="token punctuation">.</span>FesEnv <span class="token operator">=</span> config<span class="token punctuation">.</span>env<span class="token punctuation">[</span><span class="token string">'xxx'</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
<span class="token comment">// 所以打包后`this.FesEnv.api` 等于 `config.env['xxx'].api`</span>
<span class="token keyword">this</span><span class="token punctuation">.</span>FesEnv<span class="token punctuation">.</span>api <span class="token operator">===</span> config<span class="token punctuation">.</span>env<span class="token punctuation">[</span><span class="token string">'xxx'</span><span class="token punctuation">]</span><span class="token punctuation">.</span>api<span class="token punctuation">;</span>
</code></pre></div><h2 id="fesstorage-2"><a href="#fesstorage-2" class="header-anchor">#</a> FesStorage</h2> <p>操作Storage包含cookie、sessionStorage、localStorage。 category值session对应sessionStoragelocal对应localStoragecookie对应cookie</p> <h3 id="set-3"><a href="#set-3" class="header-anchor">#</a> set</h3> <p>往Storage中存入一个值
<strong>set(key, value, category = SESSION, expired)</strong><br> <code>key</code>是给值取的名称<br> <code>value</code>是值的内容<br> <code>category</code>是储存的类型,可选值有<code>session</code><code>local</code><code>cookie</code><br> <code>expired</code>是储存的时间,当<code>category</code><code>cookie</code>时可用</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesStorage<span class="token punctuation">.</span><span class="token function">set</span><span class="token punctuation">(</span>key<span class="token punctuation">,</span> value<span class="token punctuation">,</span> category<span class="token punctuation">,</span> expired<span class="token punctuation">)</span>
</code></pre></div><h3 id="get-3"><a href="#get-3" class="header-anchor">#</a> get</h3> <p>从Storage中取key对应的值
<strong>get(key, category = SESSION)</strong><br> <code>key</code>是给值取的名称<br> <code>category</code>是储存的类型,可选值有<code>session</code><code>local</code><code>cookie</code></p> <h3 id="clear-2"><a href="#clear-2" class="header-anchor">#</a> clear</h3> <p>清除某个类型的所有值<br> <strong>clear(category = SESSION)</strong><br> <code>category</code>是储存的类型,可选值有<code>session</code><code>local</code><code>cookie</code></p> <h3 id="remove"><a href="#remove" class="header-anchor">#</a> remove</h3> <p>删除key对应的值<br> <strong>remove(key, category = SESSION)</strong><br> <code>key</code>是给值取的名称<br> <code>category</code>是储存的类型,可选值有<code>session</code><code>local</code><code>cookie</code></p> <h2 id="fesutil-2"><a href="#fesutil-2" class="header-anchor">#</a> FesUtil</h2> <h3 id="getclass"><a href="#getclass" class="header-anchor">#</a> getClass</h3> <p>获取dom节点<code>el</code>的样式class</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesUtil<span class="token punctuation">.</span><span class="token function">getClass</span><span class="token punctuation">(</span>el<span class="token punctuation">)</span>
</code></pre></div><h3 id="hasclass"><a href="#hasclass" class="header-anchor">#</a> hasClass</h3> <p>判断dom节点是否有样式<code>name</code></p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesUtil<span class="token punctuation">.</span><span class="token function">hasClass</span><span class="token punctuation">(</span>el<span class="token punctuation">,</span> name<span class="token punctuation">)</span>
</code></pre></div><h3 id="setclass"><a href="#setclass" class="header-anchor">#</a> setClass</h3> <p>给dom节点<code>el</code>设置样式<code>cls</code></p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesUtil<span class="token punctuation">.</span><span class="token function">setClass</span><span class="token punctuation">(</span>el<span class="token punctuation">,</span> cls<span class="token punctuation">)</span>
</code></pre></div><h3 id="addclass"><a href="#addclass" class="header-anchor">#</a> addClass</h3> <p>给dom节点<code>el</code>添加一个样式<code>name</code></p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesUtil<span class="token punctuation">.</span><span class="token function">addClass</span><span class="token punctuation">(</span>el<span class="token punctuation">,</span> name<span class="token punctuation">)</span>
</code></pre></div><h3 id="removeclass"><a href="#removeclass" class="header-anchor">#</a> removeClass</h3> <p>删除节点<code>el</code>的样式<code>cls</code></p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesUtil<span class="token punctuation">.</span><span class="token function">removeClass</span><span class="token punctuation">(</span>el<span class="token punctuation">,</span> cls<span class="token punctuation">)</span>
</code></pre></div><h3 id="contains"><a href="#contains" class="header-anchor">#</a> contains</h3> <p>节点<code>el</code>是否是节点<code>parentEl</code>的子节点</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesUtil<span class="token punctuation">.</span><span class="token function">contains</span><span class="token punctuation">(</span>parentEl<span class="token punctuation">,</span> el<span class="token punctuation">)</span>
</code></pre></div><h3 id="isplainobject"><a href="#isplainobject" class="header-anchor">#</a> isPlainObject</h3> <p>是否是纯粹的Object对象</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesUtil<span class="token punctuation">.</span><span class="token function">isPlainObject</span><span class="token punctuation">(</span>obj<span class="token punctuation">)</span>
</code></pre></div><h3 id="isobject"><a href="#isobject" class="header-anchor">#</a> isObject</h3> <p>是否是Object对象</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesUtil<span class="token punctuation">.</span><span class="token function">isObject</span><span class="token punctuation">(</span>obj<span class="token punctuation">)</span>
</code></pre></div><h3 id="isnumber"><a href="#isnumber" class="header-anchor">#</a> isNumber</h3> <p>是否是数字</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesUtil<span class="token punctuation">.</span><span class="token function">isNumber</span><span class="token punctuation">(</span>num<span class="token punctuation">)</span>
</code></pre></div><h3 id="isdate"><a href="#isdate" class="header-anchor">#</a> isDate</h3> <p>是否是日期</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesUtil<span class="token punctuation">.</span><span class="token function">isDate</span><span class="token punctuation">(</span>date<span class="token punctuation">)</span>
</code></pre></div><h3 id="isfunction"><a href="#isfunction" class="header-anchor">#</a> isFunction</h3> <p>是否是函数</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesUtil<span class="token punctuation">.</span><span class="token function">isFunction</span><span class="token punctuation">(</span>fn<span class="token punctuation">)</span>
</code></pre></div><h3 id="isarray"><a href="#isarray" class="header-anchor">#</a> isArray</h3> <p>是否是数组</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesUtil<span class="token punctuation">.</span><span class="token function">isArray</span><span class="token punctuation">(</span>array<span class="token punctuation">)</span>
</code></pre></div><h3 id="isstring"><a href="#isstring" class="header-anchor">#</a> isString</h3> <p>是否是字符串</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesUtil<span class="token punctuation">.</span><span class="token function">isString</span><span class="token punctuation">(</span>str<span class="token punctuation">)</span>
</code></pre></div><h3 id="isnull"><a href="#isnull" class="header-anchor">#</a> isNull</h3> <p>是否为空为undefined、null或者空字符串</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesUtil<span class="token punctuation">.</span><span class="token function">isNull</span><span class="token punctuation">(</span>something<span class="token punctuation">)</span>
</code></pre></div><h3 id="event-on"><a href="#event-on" class="header-anchor">#</a> event.on</h3> <p>绑定事件
<strong>event.on(key, fn)</strong><br> <code>key</code>是事件名称<br> <code>fn</code>是事件触发时执行的回调函数</p> <h3 id="event-one"><a href="#event-one" class="header-anchor">#</a> event.one</h3> <p>绑定事件,只监听一次就销毁<br> <strong>event.one(key, fn)</strong><br> <code>key</code>是事件名称<br> <code>fn</code>是事件触发时执行的回调函数</p> <h3 id="event-off"><a href="#event-off" class="header-anchor">#</a> event.off</h3> <p>取消绑定事件<br> <strong>event.off(key)</strong><br> <code>key</code>是事件名称</p> <h3 id="event-trigger"><a href="#event-trigger" class="header-anchor">#</a> event.trigger</h3> <p>触发事件<br> <strong>event.trigger(key)</strong><br> <code>key</code>是事件名称</p> <h4 id=""><a href="#" class="header-anchor">#</a> _</h4> <p>lodash工具函数集</p> <div class="language-js extra-class"><pre class="language-js"><code><span class="token keyword">this</span><span class="token punctuation">.</span>FesUtil<span class="token punctuation">.</span>_
</code></pre></div></div> <footer class="page-edit"><!----> <div class="last-updated"><span class="prefix">上次编辑时间:</span> <span class="time">11/27/2020, 3:38:53 AM</span></div></footer> <!----> </main></div><div class="global-ui"><!----></div></div>
<script src="/fes.js/assets/js/app.d4a34833.js" defer></script><script src="/fes.js/assets/js/2.1380c702.js" defer></script><script src="/fes.js/assets/js/37.6bc69c79.js" defer></script><script src="/fes.js/assets/js/10.2329d47f.js" defer></script>
</body>
</html>