GITLAB

essa-platform / es-ng-antd

Sign in
  • Sign in
  • Project
  • Files
  • Commits
  • Network
  • Graphs
  • Issues 0
  • Merge Requests 0
  • Wiki
  • es-ng-antd
  • src
  • Slot
  • Slot.js
  • a4efb55f   feat(table): 优化组件 Browse Code »
    Imshann
    2022-01-21 18:31:30 +0800  
Slot.js 612 Bytes
Edit Raw Blame History
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
class Slot {
    props = {
        content: String,
        context: Object,
    };

    useModules = ["$compile"];

    watch = {
        content: (newValue) => {
            if (newValue !== undefined) {
                if (/<[^>]+>/.test(newValue)) {
                    $element.replaceWith(
                        $compile(newValue)(
                            $scope.context ? $scope.context : $scope
                        )
                    );
                } else {
                    $element.text(newValue);
                }
            }
        },
    };
    
    constructor() {

    }
}