@hhfenpm/micro-app 1.0.6 → 1.0.7
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/dist/index.esm.js +18 -2
- package/dist/index.js +18 -4
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -426,6 +426,22 @@ function baseSyncPlugin({
|
|
|
426
426
|
}
|
|
427
427
|
}
|
|
428
428
|
|
|
429
|
-
|
|
429
|
+
function syncState(watch = {}) {
|
|
430
|
+
return function SYNC_STATE(state, payload) {
|
|
431
|
+
if (!payload || typeof payload !== 'object') return
|
|
432
|
+
|
|
433
|
+
Object.keys(watch).forEach(key => {
|
|
434
|
+
if (state[key] !== payload[key] && typeof watch[key] === 'function')
|
|
435
|
+
watch[key]({
|
|
436
|
+
store: this,
|
|
437
|
+
value: payload[key],
|
|
438
|
+
valueOld: state[key],
|
|
439
|
+
});
|
|
440
|
+
});
|
|
441
|
+
Object.keys(payload).forEach(key => {
|
|
442
|
+
if (state[key] !== payload[key]) state[key] = payload[key];
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
}
|
|
430
446
|
|
|
431
|
-
export { baseSyncPlugin, createMicroAppCore, createRegisterHandlers,
|
|
447
|
+
export { baseSyncPlugin, createMicroAppCore, createRegisterHandlers, initBridge, syncState };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var uiHandler = vm => ({
|
|
6
4
|
$message: (...args) => vm.$message(...args),
|
|
7
5
|
$success: msg => vm.$message.success(msg),
|
|
@@ -430,10 +428,26 @@ function baseSyncPlugin({
|
|
|
430
428
|
}
|
|
431
429
|
}
|
|
432
430
|
|
|
433
|
-
|
|
431
|
+
function syncState(watch = {}) {
|
|
432
|
+
return function SYNC_STATE(state, payload) {
|
|
433
|
+
if (!payload || typeof payload !== 'object') return
|
|
434
|
+
|
|
435
|
+
Object.keys(watch).forEach(key => {
|
|
436
|
+
if (state[key] !== payload[key] && typeof watch[key] === 'function')
|
|
437
|
+
watch[key]({
|
|
438
|
+
store: this,
|
|
439
|
+
value: payload[key],
|
|
440
|
+
valueOld: state[key],
|
|
441
|
+
});
|
|
442
|
+
});
|
|
443
|
+
Object.keys(payload).forEach(key => {
|
|
444
|
+
if (state[key] !== payload[key]) state[key] = payload[key];
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
}
|
|
434
448
|
|
|
435
449
|
exports.baseSyncPlugin = baseSyncPlugin;
|
|
436
450
|
exports.createMicroAppCore = createMicroAppCore;
|
|
437
451
|
exports.createRegisterHandlers = createRegisterHandlers;
|
|
438
|
-
exports.default = index;
|
|
439
452
|
exports.initBridge = initBridge;
|
|
453
|
+
exports.syncState = syncState;
|