import Icon from '../icon';
import './index.less';

var Loading = {
    name: 'SnLoading',
    props: {
        spinning: {
            type: Boolean,
            'default': false
        },
        tip: {
            type: String,
            'default': '加载中...'
        }
    },
    methods: {},
    render: function render() {
        var h = arguments[0];
        var spinning = this.spinning,
            tip = this.tip;


        return spinning ? h(
            'section',
            { 'class': 'sn-loading' },
            [h(Icon, {
                attrs: { type: 'loading' }
            }), h(
                'div',
                { 'class': 'sn-loading-tip' },
                [tip]
            )]
        ) : null;
    }
};

Loading.install = function (Vue) {
    Vue.component(Loading.name, Loading);
};

export default Loading;