This commit is contained in:
harrywan 2021-04-29 10:59:09 +08:00
commit 3353152290
11 changed files with 114 additions and 31 deletions

View File

@ -59,6 +59,7 @@ Fes.js 是一个好用的前端应用解决方案。Fes.js 以 Vue 3.0 和路由
| [@fesjs/plugin-request](https://winixt.gitee.io/fesjs/zh/reference/plugin/plugins/request.html#%E5%90%AF%E7%94%A8%E6%96%B9%E5%BC%8F) | 基于 `Axios` 封装的 request内置防止重复请求、请求节流、错误处理等功能 |
| [@fesjs/plugin-vuex](https://winixt.gitee.io/fesjs/zh/reference/plugin/plugins/vuex.html#%E5%90%AF%E7%94%A8%E6%96%B9%E5%BC%8F) | 基于 `Vuex`, 提供状态管理能力 |
| [@fesjs/plugin-qiankun](https://winixt.gitee.io/fesjs/zh/reference/plugin/plugins/qiankun.html#%E4%BB%8B%E7%BB%8D) | 基于 `qiankun`,提供微服务能力 |
| [@fesjs/plugin-sass](https://winixt.gitee.io/fesjs/zh/reference/plugin/plugins/sass.html#%E4%BB%8B%E7%BB%8D) | 样式支持sass |
## 像数 1, 2, 3 一样容易
使用 `yarn`
@ -103,3 +104,16 @@ For bugs and feature requests, [please create an issue](https://github.com/WeBan
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D
## 社区活动
### Fesjs 社区有奖征文活动
为了 Fes.js 开源项目更好的运转,同时回馈开源社区,社区推出有奖征文活动!欢迎大家投递实践经验,给社区用户,更广泛的开发者提供借鉴。
经验输出也可以帮助到你系统沉淀自有项目,梳理工作思路,也能够帮助你的技术博客做宣传。优秀的实践案例将有机会邀请参与项目社区技术会议分享,赶快来参与吧。
请戳https://mp.weixin.qq.com/s/nV4NG_OUUrdgtft8g_IW4g

View File

@ -7,22 +7,22 @@ export const en: SidebarConfig = {
text: '介绍',
children: [
'/guide/README.md',
'/guide/getting-started.md',
'/guide/getting-started.md',
],
},
{
isGroup: true,
text: '基础',
children: [
'/guide/directory-structure.md',
'/guide/config.md',
'/guide/runtime-config.md',
'/guide/route.md',
'/guide/plugin.md',
'/guide/template.md',
'/guide/mock.md',
'/guide/env.md',
'/guide/css.md',
'/guide/directory-structure.md',
'/guide/config.md',
'/guide/runtime-config.md',
'/guide/route.md',
'/guide/plugin.md',
'/guide/template.md',
'/guide/mock.md',
'/guide/env.md',
'/guide/css.md',
]
},
{
@ -61,6 +61,7 @@ export const en: SidebarConfig = {
'/reference/plugin/plugins/request.md',
'/reference/plugin/plugins/vuex.md',
'/reference/plugin/plugins/qiankun.md',
'/reference/plugin/plugins/sass.md',
],
},
{

View File

@ -7,22 +7,22 @@ export const zh: SidebarConfig = {
text: '介绍',
children: [
'/zh/guide/README.md',
'/zh/guide/getting-started.md',
'/zh/guide/getting-started.md',
],
},
{
isGroup: true,
text: '基础',
children: [
'/zh/guide/directory-structure.md',
'/zh/guide/config.md',
'/zh/guide/runtime-config.md',
'/zh/guide/route.md',
'/zh/guide/plugin.md',
'/zh/guide/template.md',
'/zh/guide/mock.md',
'/zh/guide/env.md',
'/zh/guide/css.md',
'/zh/guide/directory-structure.md',
'/zh/guide/config.md',
'/zh/guide/runtime-config.md',
'/zh/guide/route.md',
'/zh/guide/plugin.md',
'/zh/guide/template.md',
'/zh/guide/mock.md',
'/zh/guide/env.md',
'/zh/guide/css.md',
]
},
{
@ -61,6 +61,7 @@ export const zh: SidebarConfig = {
'/zh/reference/plugin/plugins/request.md',
'/zh/reference/plugin/plugins/vuex.md',
'/zh/reference/plugin/plugins/qiankun.md',
'/zh/reference/plugin/plugins/sass.md',
],
},
{

View File

@ -0,0 +1,27 @@
# @fesjs/plugin-access
## 介绍
Fes.js 默认只支持 `less`,通过此插件扩展支持 `sass`
## 启用方式
`package.json` 中引入依赖:
```json
{
"dependencies": {
"@fesjs/fes": "^2.0.0",
"@fesjs/plugin-sass": "^2.0.0"
},
}
```
## global css
添加 `src/global.scss``src/global.sass` 为全局CSS入口添加一些通用样式内容。
## Vue 单文件组件
Vue 单文件组件的 `<style></style>` 添加 `lang='scss'`,例如:
```vue
<style lang="scss">
</style>
```

View File

@ -51,6 +51,8 @@ export const request = {
responseDataAdaptor: (data) => {
},
// 关闭 response data 校验(只判断 xhr status
closeResDataCheck: false,
// 请求拦截器
requestInterceptors: [],
// 相应拦截器

View File

@ -0,0 +1,27 @@
# @fesjs/plugin-access
## 介绍
Fes.js 默认只支持 `less`,通过此插件扩展支持 `sass`
## 启用方式
`package.json` 中引入依赖:
```json
{
"dependencies": {
"@fesjs/fes": "^2.0.0",
"@fesjs/plugin-sass": "^2.0.0"
},
}
```
## global css
添加 `src/global.scss``src/global.sass` 为全局CSS入口添加一些通用样式内容。
## Vue 单文件组件
Vue 单文件组件的 `<style></style>` 添加 `lang='scss'`,例如:
```vue
<style lang="scss">
</style>
```

View File

@ -1,5 +1,5 @@
{
"version": "2.0.0-rc.18",
"version": "2.0.0-rc.19",
"changelog": {
"repo": "WeBankFinTech/fes.js",
"cacheDir": ".changelog",

View File

@ -1,6 +1,6 @@
{
"name": "@fesjs/plugin-request",
"version": "2.0.0-rc.16",
"version": "2.0.0-rc.19",
"description": "@fesjs/plugin-request",
"main": "lib/index.js",
"files": [

View File

@ -25,9 +25,10 @@ export default async (ctx, next) => {
const {
error,
errorHandler = {},
response
response,
config
} = ctx;
if (response && isObject(response.data)) {
if (!config.closeResDataCheck && response && isObject(response.data)) {
const code = response.data.code;
if (code !== '0') {
handleAbnormalCode(errorHandler, code, response);

View File

@ -1,4 +1,14 @@
export const request = {
responseInterceptors: [(response) => {
console.log(response);
if (response.data !== '0') {
return Promise.reject({
response
});
}
return response;
}],
closeResDataCheck: true,
errorHandler: {
111(responseData) {
console.log(responseData);
@ -7,7 +17,7 @@ export const request = {
console.log('to 404 page');
},
default(error) {
console.log(error.response.data);
console.log(error);
}
}
};

View File

@ -2,8 +2,6 @@
<div class="onepiece">
fes & 拉夫德鲁<br />
<fes-icon :spin="true" class="one-icon" type="smile" @click="clickIcon" />
<div v-if="loading" class="loading">loading</div>
<div v-else class="data">{{data}}</div>
</div>
</template>
<config>
@ -14,7 +12,7 @@
</config>
<script>
import { ref, onMounted } from 'vue';
import { useRouter, useRequest } from '@fesjs/fes';
import { useRouter, request } from '@fesjs/fes';
export default {
setup() {
@ -28,12 +26,14 @@ export default {
const clickIcon = () => {
console.log('click Icon');
};
const { loading, data } = useRequest('/api', null, {
request('/api', null, {
dataField: false
}).then((res) => {
console.log(res);
}).catch((err) => {
console.error(err);
});
return {
loading,
data,
fes,
rotate,
clickIcon