共计 989 个字符,预计需要花费 3 分钟才能阅读完成。
本文只记录对子利用须要革新的点
FAQ
-
嵌入主利用后接口申请跨域问题
proxy 中减少 onProxyRes 拦挡, 解决响应头onProxyRes: function (proxyRes, req, res) {console.log(req.url); if (req.method === 'OPTIONS') {proxyRes.headers['Access-Control-Allow-Origin'] = req.headers.origin || '*' proxyRes.headers['Access-Control-Allow-Credentials'] = true proxyRes.headers['Access-Control-Allow-Methods'] = 'GET,POST,OPTIONS,PUT,DELETE,FETCH' // 这里的参数,依据本人我的项目增删 proxyRes.headers['Access-Control-Allow-Headers'] = 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,token,source,Language,Referer,Accept' proxyRes.statusCode = 204 } else {proxyRes.headers['Access-Control-Allow-Origin'] = req.headers.origin || '*' proxyRes.headers['Access-Control-Allow-Credentials'] = true } }
-
切换子利用状态放弃
对于无界的几种运行模式参见: https://wujie-micro.github.io/doc/guide/mode.html#%E5%8D%95%E…
和乾坤相似, 入口文件导出钩子if (window.__POWERED_BY_WUJIE__) {window.__WUJIE_MOUNT = () => {render() }; window.__WUJIE_UNMOUNT = () => {instance.$destroy(); instance.$el.innerHTML = '' instance = null }; }else{render() }
正文完