Commit 141036f 1 parent ea72021 commit 141036f Copy full SHA for 141036f
File tree 3 files changed +75
-34
lines changed
front-end/h5/src/components/plugins
3 files changed +75
-34
lines changed Original file line number Diff line number Diff line change 1
1
import LbpFormRadio from './lbp-form-radio.js'
2
2
3
- const defaultItems = [
4
- {
5
- value : '选项A'
6
- } ,
7
- {
8
- value : '选项B'
9
- } ,
10
- {
11
- value : '选项C'
12
- }
13
- ]
3
+ function getDefaultItems ( ) {
4
+ // defaultItems.slice(0)[0] === defaultItems.slice(0)[0] -> true
5
+ // Object.assign(defaultItems)[0] === Object.assign(defaultItems)[0] -> true
6
+ // clone = (val) => JSON.parse(JSON.stringify(val))
7
+ // clone(defaultItems)[0] === clone(defaultItems)[0] -> false
8
+ const defaultItems = [
9
+ {
10
+ value : '选项A'
11
+ } ,
12
+ {
13
+ value : '选项B'
14
+ } ,
15
+ {
16
+ value : '选项C'
17
+ }
18
+ ]
19
+
20
+ return defaultItems
21
+ }
14
22
15
23
export default {
16
24
name : 'lbp-form-checkbox-group' ,
@@ -29,7 +37,7 @@ export default {
29
37
} ,
30
38
items : {
31
39
type : Array ,
32
- default : ( ) => defaultItems ,
40
+ default : ( ) => getDefaultItems ( ) ,
33
41
editor : {
34
42
type : 'lbs-prop-text-enum-editor' ,
35
43
label : '选项列表' ,
Original file line number Diff line number Diff line change
1
+ /*
2
+ * @Author : ly525
3
+ * @Date : 2019-11-23 12:35:43
4
+ * @LastEditors : ly525
5
+ * @LastEditTime : 2019-11-23 19:50:57
6
+ * @FilePath : /luban-h5/front-end/h5/src/components/plugins/lbp-form-radio-group.js
7
+ * @Github : https://github.com/ly525/luban-h5
8
+ * @Description : 表单单选组组件 #!en: radio group component
9
+ * @Copyright 2018 - 2019 luban-h5. All Rights Reserved
10
+ */
11
+
1
12
import LbpFormRadio from './lbp-form-radio.js'
2
- // import { genUUID } from '../../utils/element.js'
3
13
4
- const defaultItems = [
5
- {
6
- value : '选项A'
7
- } ,
8
- {
9
- value : '选项B'
10
- } ,
11
- {
12
- value : '选项C'
13
- }
14
- ]
14
+ function getDefaultItems ( ) {
15
+ // defaultItems.slice(0)[0] === defaultItems.slice(0)[0] -> true
16
+ // Object.assign(defaultItems)[0] === Object.assign(defaultItems)[0] -> true
17
+ // clone = (val) => JSON.parse(JSON.stringify(val))
18
+ // clone(defaultItems)[0] === clone(defaultItems)[0] -> false
19
+ const defaultItems = [
20
+ {
21
+ value : '选项A'
22
+ } ,
23
+ {
24
+ value : '选项B'
25
+ } ,
26
+ {
27
+ value : '选项C'
28
+ }
29
+ ]
30
+
31
+ return defaultItems
32
+ }
15
33
16
34
export default {
17
35
name : 'lbp-form-radio-group' ,
@@ -27,7 +45,7 @@ export default {
27
45
} ,
28
46
items : {
29
47
type : Array ,
30
- default : ( ) => defaultItems ,
48
+ default : ( ) => getDefaultItems ( ) ,
31
49
editor : {
32
50
type : 'lbs-prop-text-enum-editor' ,
33
51
label : '选项列表' ,
Original file line number Diff line number Diff line change
1
+ /*
2
+ * @Author : ly525
3
+ * @Date : 2019-11-23 12:35:21
4
+ * @LastEditors : ly525
5
+ * @LastEditTime : 2019-11-23 19:53:14
6
+ * @FilePath : /luban-h5/front-end/h5/src/components/plugins/lbp-slide.js
7
+ * @Github : https://github.com/ly525/luban-h5
8
+ * @Description : #!zh: 轮播图组件 #!en slide component
9
+ * @Copyright 2018 - 2019 luban-h5. All Rights Reserved
10
+ */
11
+
1
12
import { Swipe , SwipeItem } from 'vant'
2
13
import 'vant/lib/swipe/style'
3
14
import 'vant/lib/swipe-item/style'
4
15
5
- const defaultItems = [
6
- {
7
- image : 'https://img.yzcdn.cn/vant/apple-1.jpg'
8
- } ,
9
- {
10
- image : 'https://img.yzcdn.cn/vant/apple-2.jpg'
11
- }
12
- ]
16
+ function getDefaultItems ( ) {
17
+ const defaultItems = [
18
+ {
19
+ image : 'https://img.yzcdn.cn/vant/apple-1.jpg'
20
+ } ,
21
+ {
22
+ image : 'https://img.yzcdn.cn/vant/apple-2.jpg'
23
+ }
24
+ ]
25
+
26
+ return defaultItems
27
+ }
13
28
14
29
export default {
15
30
name : 'lbp-slide' ,
@@ -36,7 +51,7 @@ export default {
36
51
} ,
37
52
items : {
38
53
type : Array ,
39
- default : ( ) => defaultItems . slice ( 0 ) ,
54
+ default : ( ) => getDefaultItems ( ) ,
40
55
editor : {
41
56
custom : true
42
57
}
You can’t perform that action at this time.
0 commit comments