50f4289a
Imshann
优化Form组件
|
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
return {
template: template,
restrict: "E",
replace: true,
transclude: true,
scope: {
name: "@",
label: "@",
labelCol: "=",
wrapperCol: "=",
required: "="
},
require: ["^?antdForm"],
controller: function ($scope, $element, $attrs) {
this.getContext = function () {
return $scope;
};
|
50f4289a
Imshann
优化Form组件
|
24
25
26
27
28
29
30
|
$scope.state = {
labelCol: null,
wrapperCol: null
};
},
link: function ($scope, $element, $attrs, $controllers) {
let [antdForm] = $controllers;
|
50f4289a
Imshann
优化Form组件
|
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
if ($scope.labelCol && $scope.labelCol.span) {
$scope.state.labelCol = $scope.labelCol.span;
} else if ($scope.antdForm.labelCol && $scope.antdForm.labelCol.span) {
$scope.state.labelCol = $scope.antdForm.labelCol.span;
}
if ($scope.wrapperCol && $scope.wrapperCol.span) {
$scope.state.wrapperCol = $scope.wrapperCol.span;
} else if ($scope.antdForm.wrapperCol && $scope.antdForm.wrapperCol.span) {
$scope.state.wrapperCol = $scope.antdForm.wrapperCol.span;
}
}
};
});
|