<script>
import { $Toast } from 'iview-mpvue/dist/components/base'
export default {
...
methods: {
handleText () {
$Toast(this, {
content: '这是文本提示'
})
},
handleSuccess () {
$Toast(this, {
content: '成功的提示',
type: 'success'
})
},
handleWarning () {
$Toast(this, {
content: '警告的提示',
type: 'warning'
})
},
handleError () {
$Toast(this, {
content: '错误的提示',
type: 'error'
})
},
handleLoading () {
$Toast(this, {
content: '加载中',
type: 'loading'
})
},
handleIcon () {
$Toast(this, {
content: '使用内置的图标',
icon: 'praise'
})
},
handleImage () {
$Toast(this, {
content: '使用自定义图片',
image: 'https://i.loli.net/2017/08/21/599a521472424.jpg'
})
},
handleMask () {
$Toast(this, {
content: '5秒后自动关闭',
icon: 'prompt',
duration: 0,
mask: false
});
setTimeout(() => {
$Toast.hide(this)
}, 5000)
}
}
}
</script>