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
  • ddd373d9   优化Card组件 Browse Code »
    Imshann
    2022-02-16 14:04:59 +0800  
Slot.js 628 Bytes
Edit Raw Blame History Permalink
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
class Slot {

    useModules = ["$compile"];
    
    componentDidUpdate(prevProps) {
        if(prevProps.content !== this.props.content) {
        	if (newVal !== undefined) {
                if (/<[^>]+>/.test(newVal)) {
                    $element.replaceWith(
                        $compile(newVal)(
                            $scope.context ? $scope.context : $scope
                        )
                    );
                } else {
                    $element.text(newVal);
                }
            }
        }
    }
}

Slot.propTypes = {
    content: PropTypes.string,
    context: PropTypes.object,
};