@extscreen/es-core 1.1.25 → 1.1.27

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.
Files changed (2) hide show
  1. package/dist/index.js +46 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3157,6 +3157,13 @@ const ES_NETWORK_INFO_TYPE_ETHERNET = 9;
3157
3157
 
3158
3158
  var ESApplication = {
3159
3159
  mixins: [ESRouter],
3160
+ data() {
3161
+ return {
3162
+ appInitProps: {},
3163
+ appInitUrl: '',
3164
+ appInitParams: {},
3165
+ };
3166
+ },
3160
3167
  mounted() {
3161
3168
  this._initES();
3162
3169
  },
@@ -3168,16 +3175,32 @@ var ESApplication = {
3168
3175
  })
3169
3176
  )
3170
3177
  .then((result) => {
3171
- this._initESApp();
3178
+ this._initESAppParams();
3172
3179
  },
3173
3180
  error => {
3174
- this._initESApp();
3181
+ this._initESAppParams();
3175
3182
  }
3176
3183
  );
3177
3184
  },
3185
+ _initESAppParams() {
3186
+ //
3187
+ this.appInitProps = ESApp.$options.$superProps;
3188
+ //
3189
+ this.appInitUrl = ESApp.$options.$superProps.url;
3190
+ this.appInitParams = ESApp.$options.$superProps.params;
3191
+
3192
+ if (!this.appInitUrl) {
3193
+ this.appInitUrl = this.$router.options.main;
3194
+ }
3195
+ if (!(this._isRoutePathValid(this.appInitUrl) || this._isRouteNameValid(this.appInitUrl))) {
3196
+ this.appInitUrl = this.$router.options.error;
3197
+ }
3198
+ //
3199
+ this._initESApp();
3200
+ },
3178
3201
  _initESApp() {
3179
3202
  if (this._isFunction(this.onESCreate)) {
3180
- let result = this.onESCreate();
3203
+ let result = this.onESCreate(this.appInitProps);
3181
3204
  if (ESLog.isLoggable(ESLog.DEBUG)) {
3182
3205
  ESLog.d('ESApplication', '---------onESCreate---------->>>>', result);
3183
3206
  }
@@ -3210,14 +3233,9 @@ var ESApplication = {
3210
3233
  }
3211
3234
  },
3212
3235
  _initPage() {
3213
- let initUrl = ESApp.$options.$superProps.url;
3214
- let initParams = ESApp.$options.$superProps.params;
3215
- if (!initUrl) {
3216
- initUrl = this.$router.options.main;
3217
- }
3218
3236
  let route = {
3219
- name: initUrl,
3220
- params: initParams,
3237
+ name: this.appInitUrl,
3238
+ params: this.appInitParams,
3221
3239
  };
3222
3240
  if (ESLog.isLoggable(ESLog.DEBUG)) {
3223
3241
  console.log('ESApplication', '---------onESCreate---_initPage--push--->>>>', route);
@@ -3227,6 +3245,24 @@ var ESApplication = {
3227
3245
  _isFunction(func) {
3228
3246
  return Object.prototype.toString.call(func) === '[object Function]';
3229
3247
  },
3248
+ _isRoutePathValid(path) {
3249
+ if (path !== undefined && path !== '') {
3250
+ let index = this.$router.options.routes.findIndex((item) => item.path === `/${path}`);
3251
+ if (index !== -1) {
3252
+ return true;
3253
+ }
3254
+ }
3255
+ return false;
3256
+ },
3257
+ _isRouteNameValid(name) {
3258
+ if (name !== undefined && name !== '') {
3259
+ let index = this.$router.options.routes.findIndex((item) => item.path === `${name}`);
3260
+ if (index !== -1) {
3261
+ return true;
3262
+ }
3263
+ }
3264
+ return false;
3265
+ },
3230
3266
  },
3231
3267
  };
3232
3268
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@extscreen/es-core",
3
- "version": "1.1.25",
3
+ "version": "1.1.27",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {