ocpview-pro 0.1.20 → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ocpview-pro",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "title": "ocpviewPlus",
5
5
  "description": "A high quality Service UI components Library with Vue.js",
6
6
  "homepage": "",
@@ -3,14 +3,14 @@
3
3
  <Col span="18">
4
4
  <Row v-if="!notpowerFlag" type="flex" :gutter="0" justify="start" align="middle">
5
5
  <Col v-if="addDataBtnFlag">
6
- <Button :custom-icon="mainButtonCustomIcon" :icon="mainButtonIcon" type="primary" class="mainBtn" :disabled="!!addReadOnly" @click="addData" >{{myConfig.mainButtonText}}</Button>
6
+ <Button :custom-icon="mainButtonCustomIcon" :icon="mainButtonIcon" type="primary" class="mainBtn" :disabled="!!addReadOnly" @click="addData" >{{$t(myConfig.mainButtonText)}}</Button>
7
7
  </Col>
8
8
  <Col v-if="addDataBtnFlag">
9
9
  <Divider type="vertical" class="dividercommon"/>
10
10
  </Col>
11
11
  <template v-for="(item,index) in btnItems" :key="'btn_' + index">
12
12
  <Col v-if="!moreFlag || index < myConfig.showNum" style="margin-right:10px">
13
- <Button :icon="item.icon" :custom-icon="item.customIcon" @click="action(item.name)" :disabled="!!item.readOnly">{{item.text}}</Button>
13
+ <Button :icon="item.icon" :custom-icon="item.customIcon" @click="action(item.name)" :disabled="!!item.readOnly">{{item.text ? $t(item.text) : item.text}}</Button>
14
14
  </Col>
15
15
  </template>
16
16
  <Col v-if="moreFlag">
@@ -65,7 +65,7 @@ export default {
65
65
  modulecode:'',
66
66
  items:[],
67
67
  mainButton:'addData',
68
- mainButtonText:this.$t('新增'),
68
+ mainButtonText:'新增',
69
69
  mainButtonIcon:null,
70
70
  mainButtonCustomIcon:'iconfont icon-custom-add'
71
71
  },
@@ -428,7 +428,7 @@ export default {
428
428
 
429
429
  if (this.myConfig.showRootNode) {
430
430
  let root = {
431
- title: ' ' + this.myConfig.rootNode.name,
431
+ title: ' ' + this.$t(this.myConfig.rootNode.name),
432
432
  expand: true,
433
433
  disabled: this.myConfig.readOnly,
434
434
  children: tree,
package/src/index.js CHANGED
@@ -223,6 +223,7 @@ if (typeof window !== 'undefined' && window.Vue) {
223
223
  const API = {
224
224
  version: pkg.version, // eslint-disable-line no-undef
225
225
  install,
226
+ localeReady: localePlus.localeReady,
226
227
  //...ViewUI,
227
228
  ...components
228
229
  };
@@ -65,6 +65,9 @@ const getReportLocaleMessage = async () => {
65
65
  };
66
66
  const localeMap = { CN: "zh-CN", TR: "zh-TW", EN: "en-US" };
67
67
 
68
+ // 动态语言包合并完成的 Promise,供业务在 app.mount 前 await,保证组件 created 期 $t() 已包含动态 key
69
+ let localeReadyPromise = Promise.resolve();
70
+
68
71
  const install = function (app, options = {}) {
69
72
  if (options.defaultLocale) {
70
73
  i18n.global.locale.value = options.defaultLocale;
@@ -73,12 +76,15 @@ const install = function (app, options = {}) {
73
76
  app.config.globalProperties.$localeMap = localeMap;
74
77
 
75
78
  if (options.fetchDynamic !== false) {
76
- getReportLocaleMessage();
79
+ localeReadyPromise = getReportLocaleMessage();
77
80
  }
78
81
  };
79
82
 
83
+ export const localeReady = () => localeReadyPromise;
84
+
80
85
  export default {
81
86
  install,
82
87
  i18n,
83
88
  getReportLocaleMessage,
89
+ localeReady,
84
90
  };
@@ -928,12 +928,14 @@ caseMethod.getToken = function(_self) {
928
928
  }
929
929
  if (Cookies.get('token')) {
930
930
  token = Cookies.get('token');
931
- } else {
931
+ }
932
+ // 不能从url取,清理缓存会导致用户信息丢失,应该强制重新登录
933
+ /*else {
932
934
  let temp = caseMethod.getUrlParam('token');
933
935
  if (temp) {
934
936
  token = temp;
935
937
  }
936
- }
938
+ }*/
937
939
  return token;
938
940
  };
939
941