0.0.9 • Published 4 years ago

xz-web-bootstrap v0.0.9

Weekly downloads
33
License
-
Repository
-
Last release
4 years ago

更新日志

新增 atSameDomain 配置项,类型: Boolean,若为 true 则获取getinfo.json 文件的地址将为 ${domain}/cas

  1. 生产环境中去除了控制台输出的日志;
  2. 新增首屏加载 loading 动画;
  3. 新增登录系统自动获取 cas 信息的功能,配置项中传入 isLoginSystem 即可。

    配置项中
    ...
    currentSystem: 'Foo',
    isLoginSystem: process.env.NODE_ENV === 'production'
    ...

版本说明:

  1. 解决了内部 message 事件监听被覆盖导致执行逻辑错乱的问题并规范了 message 事件回调函数中的数据结构;
  2. 优化了不同登录状态时的处理逻辑,不再出现 401 情况,取消了 loading 页;
  3. 新增通过路由配置能细粒度控制页面状态功能。

更改:

  • currentSystem 当前系统 type String,传入 STATIC_SYSTEM 表示该系统是纯静态系统,例如登录系统,首页并非纯静态系统,它关联了 UC 模块
  • 路由配置,主要为 meta 对象中
    		...
    		meta: {
    	      isSinglePage: Boolean, // 表示是否为单个的页面 无头尾导航
    	      isStaticPage: Boolean // 表示是否为静态页面 该页面只会进行 `check` 状态检查 仅此而已
    	    }
    	 	...
关于纯静态页的一些说明:
  1. 不再需要在配置中传入 ApiClient, 但需要在main.js中使用 即 Vue.use(ApiClient)
  2. api.js 中编写方式

    import HttpClient from 'http-client'
    import axios from 'axios'
    
    const defaultConfig = {
      timeout: 2 * 60 * 1000,
      withCredentials: true
    }
    let axiosInstance = axios.create(defaultConfig)
    
    axiosInstance.interceptors.response.use(function (response) {
      let httpData = response.data
      return httpData
    }, function (error) {
      return Promise.reject(error)
    })
    
    class ApiClient extends HttpClient {
    	// ... ...
    }
  1. currentSystemName 更名为 currentSystem 必选 type String | Object

    当传入一个对象时 需要传入

    • name 当前系统名
    • isStaticPage 是否为静态页
e.g. { name: 'UC', isStaticPage: true }
  1. otherSystems 其他系统名称。type String 当需要调用其他系统接口时传入 可选 e.g. ['system1', 'system2']
  2. store里不再存入 userinfo 调用 UC 模块对应接口即可

一、差异:

  1. 样式表引入 web-bootstrap/dist/WebParentFrame.css
  2. 必须使用一套主题 web-theme ,以后会内置一套。有哪些主题?

    import WebTheme from 'web-theme/dist/aiib'  
    Vue.use(WebTheme)
  3. 路由配置

    export default [
      {
        path: '/foo',
        name: 'Foo',
        mate: {
          isSinglePage: true // 该字段用于配置是否为独立的单页视图,可选
        },
        component: () => import('path/to/foo')
      }, {
        path: '/bar',
        name: 'Bar',
    	component: () => import('path/to/bar')
      }
    ]
  4. vue 的原型上挂载了 $axiosaxios 的一个实例

二、新增:

  1. EventBus 订阅-发布事件,此对象挂载在Vue原型上,可全局使用
    vm.$EventBus.emit( eventName, […args] )
    • 参数 - {string} eventName - [...args]
			vm.$EventBus.emit('foo')  

			vm.$EventBus.on('foo', function () {
		      // do something...
		    })
注:事件名称请勿以下划线 _ 开头,避免与内置事件冲突

三、内置事件

  • _languageSwitched 国际化语言切换