033b7802
Imshann
升级spin组件
|
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
return {
template: template,
restrict: "E",
replace: true,
transclude: true,
scope: {
size: "@",
spinning: "="
},
controller: function ($scope, $element, $attrs) {
$scope.state = {
className: [],
hasChildren: false
};
},
link: function ($scope, $element, $attrs, $controllers, $transclude) {
[$element, $attrs, $controllers, $transclude].forEach(function (value, key) {
if ([undefined, null, ""].includes(value)) {
throw new Error(`${["$element", "$attrs", "$controllers", "$transclude"][key]} parameter of constructor method is required.`);
}
});
$scope.state.className = ["ant-spin", "ant-spin-spinning"];
|
033b7802
Imshann
升级spin组件
|
34
35
36
37
38
39
40
41
42
43
|
if ($scope.size === "small") {
$scope.state.className.splice(1, 0, "ant-spin-sm");
}
if ($scope.size === "large") {
$scope.state.className.splice(1, 0, "ant-spin-lg");
}
}
};
});
|