@tongfun/tf-widget 0.1.7 → 0.1.8-beta

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.
@@ -0,0 +1,104 @@
1
+ <template>
2
+ <div class="tf-layout">
3
+ <TfMenu :menu-info="menuInfo" />
4
+ <div class="tf-layout-subject">
5
+ <TfLaberBar @setCache="setCache" @deleteCache="deleteCache" />
6
+ <div class="tf-layout-subject-content">
7
+ <keep-alive :include="secondCacheArray">
8
+ <router-view />
9
+ </keep-alive>
10
+ </div>
11
+ </div>
12
+ </div>
13
+ </template>
14
+
15
+ <script>
16
+ import TfMenu from './components/tf-menu'
17
+ import TfLaberBar from './components/tf-labelbar'
18
+ export default {
19
+ name: 'TfLayout',
20
+ components: {
21
+ TfMenu,
22
+ TfLaberBar
23
+ },
24
+ props: {
25
+ menuInfo: {
26
+ type: Array,
27
+ default: function () {
28
+ return []
29
+ }
30
+ }
31
+ },
32
+ data () {
33
+ return {
34
+ cacheMap: new Map(),
35
+ secondCacheArray: [],
36
+ thirdCacheArr: []
37
+ }
38
+ },
39
+ methods: {
40
+ setCache (value) {
41
+ this.cacheMap.set(value[2] || value[1], value[1])
42
+ this.initCacheArr()
43
+ },
44
+ initCacheArr () {
45
+ this.secondCacheArray.push(
46
+ ...this.arrayDiff([...this.cacheMap.values()], this.secondCacheArray)
47
+ )
48
+ this.thirdCacheArr.push(
49
+ ...this.arrayDiff([...this.cacheMap.keys()], this.thirdCacheArr)
50
+ )
51
+ this.$emit('setSecondCache', this.secondCacheArray)
52
+ this.$emit('setThirdCache', this.thirdCacheArr)
53
+ },
54
+ arrayDiff (arr, arrRaw) {
55
+ if (Array.isArray(arr)) {
56
+ return arr.filter((i) => {
57
+ return arrRaw.indexOf(i) < 0
58
+ })
59
+ }
60
+ return []
61
+ },
62
+ deleteCache (value) {
63
+ if (Array.isArray(value)) {
64
+ value.forEach((item) => {
65
+ console.log(item)
66
+ this.cacheMap.delete(item[2] || item[1])
67
+ this.thirdCacheArr.splice(
68
+ this.thirdCacheArr.indexOf(item[2] || item[1]),
69
+ 1
70
+ )
71
+ if ([...this.cacheMap.values()].indexOf(item[1]) === -1) {
72
+ this.secondCacheArray.splice(
73
+ this.secondCacheArray.indexOf(item[2]),
74
+ 1
75
+ )
76
+ }
77
+ console.log(this.cacheMap.get(item[2] || item[1]))
78
+ })
79
+ this.$emit('setSecondCache', this.secondCacheArray)
80
+ this.$emit('setThirdCache', this.thirdCacheArr)
81
+ }
82
+ }
83
+ }
84
+ }
85
+ </script>
86
+
87
+ <style lang="less" scoped>
88
+ .tf-layout {
89
+ height: 100vh;
90
+ width: 100vw;
91
+ display: flex;
92
+ .tf-layout-subject {
93
+ flex: 1;
94
+ height: 100%;
95
+ width: 100vw;
96
+ .tf-layout-subject-content {
97
+ height: calc(100% - 35px);
98
+ background: rgb(241, 241, 241);
99
+ box-sizing: border-box;
100
+ padding: 5px 0 0 0;
101
+ }
102
+ }
103
+ }
104
+ </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tongfun/tf-widget",
3
- "version": "0.1.7",
3
+ "version": "0.1.8-beta",
4
4
  "description": "tf-widget",
5
5
  "main": "lib/tf-widget.umd.js",
6
6
  "private": false,
package/postinstall.js CHANGED
@@ -1,10 +1,10 @@
1
-
2
- const BANNER = '\u001B[96mThank you for using tf-widget for polyfilling JavaScript standard library!\u001B[0m\n\n' +
3
- '\u001B[96mWe need the best of you! Come and join us\n\n' +
4
- '\u001B[96mWe are waiting for you\n'
5
-
6
- function showBanner () {
7
- console.log(BANNER)
8
- }
9
-
10
- showBanner()
1
+
2
+ const BANNER = '\u001B[96mThank you for using tf-widget for polyfilling JavaScript standard library!\u001B[0m\n\n' +
3
+ '\u001B[96mWe need the best of you! Come and join us\n\n' +
4
+ '\u001B[96mWe are waiting for you\n'
5
+
6
+ function showBanner () {
7
+ console.log(BANNER)
8
+ }
9
+
10
+ showBanner()
package/src/index.js CHANGED
@@ -1,10 +1,11 @@
1
1
 
2
2
  import TfWidget from '../package/tf-widget'
3
3
  import SvgIcon from '../package/svg-icon'
4
-
4
+ import TfLayout from '../package/tf-layout'
5
5
  const components = [
6
6
  TfWidget,
7
- SvgIcon
7
+ SvgIcon,
8
+ TfLayout
8
9
  ]
9
10
 
10
11
  const install = function (Vue) {
@@ -16,5 +17,6 @@ const install = function (Vue) {
16
17
  export default {
17
18
  install,
18
19
  TfWidget,
19
- SvgIcon
20
+ SvgIcon,
21
+ TfLayout
20
22
  }