3a3ecabe
Imshann
init
|
1
2
3
4
5
|
/**
* 列
*/
import template from "./Col.html";
import style from "antd/lib/grid/style/index.css";
|
81f8a467
Imshann
调整组件前缀
|
6
|
angular.module("esNgAntd").directive("antdCol", function (esNgAntd) {
|
3a3ecabe
Imshann
init
|
7
|
return {
|
81f8a467
Imshann
调整组件前缀
|
8
|
controllerAs: "antdCol",
|
3a3ecabe
Imshann
init
|
9
10
11
12
13
14
15
|
restrict: "E",
transclude: true,
replace: true,
scope: {
span: "@",
},
template: template,
|
81f8a467
Imshann
调整组件前缀
|
16
|
controller: function ($scope, $element, $attrs) {
|
3a3ecabe
Imshann
init
|
17
18
19
20
21
22
23
24
|
this.getContext = function () {
return $scope;
};
$scope.state = {
className: ["ant-col"],
};
},
|
81f8a467
Imshann
调整组件前缀
|
25
|
require: ["?^antdRow"],
|
3a3ecabe
Imshann
init
|
26
|
link: function ($scope, $element, $attrs, $controllers, $transclude) {
|
81f8a467
Imshann
调整组件前缀
|
27
|
let [antdRow] = $controllers;
|
3a3ecabe
Imshann
init
|
28
29
30
31
32
33
|
esNgAntd.createStyle("ant-grid", style);
$element[0].removeAttribute("ng-style");
$element[0].removeAttribute("ng-transclude");
$element[0].removeAttribute("ng-class");
$element[0].removeAttribute("span");
|
81f8a467
Imshann
调整组件前缀
|
34
35
|
if (antdRow) {
$scope.antdRow = antdRow.getContext();
|
3a3ecabe
Imshann
init
|
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
}
if ($scope.span) {
$scope.state.className.push("ant-col-" + $scope.span);
} // if (this.props.xs) {
// this.state.className.push("col-xs-" + this.props.xs);
// }
// if (this.props.sm) {
// this.state.className.push("col-sm-" + this.props.sm);
// }
// if (this.props.md) {
// this.state.className.push("col-md-" + this.props.md);
// }
// if (this.props.lg) {
// this.state.className.push("col-lg-" + this.props.lg);
// }
// this.state.className = this.state.className.join(" ");
},
};
});
|