import Vue from 'vue'
import UITips from './Tips.vue'
import UIAlert from './Alert.vue'
import UIConfirm from './Confirm.vue'
import UILoginTips from './LoginTips.vue'

export const Tips = Vue.extend(UITips)
export const Alert = Vue.extend(UIAlert)
export const Confirm = Vue.extend(UIConfirm)
export const LoginTips = Vue.extend(UILoginTips)

export function $tips(data={}) {
    let instance = new Tips({
        data
    }).$mount()

    document.body.appendChild(instance.$el)

    Vue.nextTick(() => {
        instance.show = true
    })
}

export function $alert(data={}) {
    let instance = new Alert({
        data
    }).$mount()

    document.body.appendChild(instance.$el)

    Vue.nextTick(() => {
        instance.show = true
    })
}

export function $confirm(data={}) {
    let instance = new Confirm({
        data
    }).$mount()

    document.body.appendChild(instance.$el)

    Vue.nextTick(() => {
        instance.show = true
    })
}

export function $loginTips(data={}) {
    let instance = new LoginTips({
        data
    }).$mount()

    document.body.appendChild(instance.$el)

    Vue.nextTick(() => {
        instance.show = true
    })
}