forked from youzan/vant-weapp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
39 lines (39 loc) · 1.06 KB
/
index.js
File metadata and controls
39 lines (39 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
component_1.VantComponent({
relation: {
name: 'col',
type: 'descendant',
linked: function (target) {
if (this.data.gutter) {
target.setGutter(this.data.gutter);
}
}
},
props: {
gutter: Number
},
watch: {
gutter: 'setGutter'
},
mounted: function () {
if (this.data.gutter) {
this.setGutter();
}
},
methods: {
setGutter: function () {
var _this = this;
var gutter = this.data.gutter;
var margin = "-" + Number(gutter) / 2 + "px";
var style = gutter
? "margin-right: " + margin + "; margin-left: " + margin + ";"
: '';
this.setData({ style: style });
this.getRelationNodes('../col/index').forEach(function (col) {
col.setGutter(_this.data.gutter);
});
}
}
});