swico 0.9.2-beta3 → 0.9.2-beta5

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": "swico",
3
- "version": "0.9.2-beta3",
3
+ "version": "0.9.2-beta5",
4
4
  "description": "Simple, efficient, and practical front-end framework",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -54,13 +54,19 @@ var config_1 = require("./config");
54
54
  var Container = (function (_super) {
55
55
  __extends(Container, _super);
56
56
  function Container() {
57
- return _super !== null && _super.apply(this, arguments) || this;
57
+ var _this = _super !== null && _super.apply(this, arguments) || this;
58
+ _this.state = {
59
+ error: null
60
+ };
61
+ return _this;
58
62
  }
63
+ Container.getDerivedStateFromError = function (error) {
64
+ return { error: error.toString() };
65
+ };
59
66
  Container.prototype.componentDidCatch = function (error, errorInfo) {
60
- console.log('1');
61
67
  };
62
68
  Container.prototype.render = function () {
63
- return this.props.children;
69
+ return this.state.error ? null : this.props.children;
64
70
  };
65
71
  return Container;
66
72
  }(react_1.default.Component));
@@ -1,14 +1,15 @@
1
1
  <script setup lang="ts">
2
- import { onErrorCaptured } from 'vue';
3
-
2
+ import { onErrorCaptured, ref } from 'vue';
3
+ const error = ref<string | null>(null);
4
4
  onErrorCaptured((err, instance, info) => {
5
5
  console.error(err);
6
+ error.value = err.toString();
6
7
  return false;
7
8
  });
8
9
  </script>
9
10
 
10
11
  <template>
11
- <Layout><RouterView /></Layout>
12
+ <Layout v-if="!!error"><RouterView /></Layout>
12
13
  </template>
13
14
 
14
15
  <style scoped></style>