|
@@ -13,4 +13,36 @@ export default {
|
|
|
return fn.apply(context, args)
|
|
|
}
|
|
|
},
|
|
|
+ copyToClipBoard(content) {
|
|
|
+ let tempDom = document.createElement('input')
|
|
|
+ tempDom.setAttribute('value', content)
|
|
|
+ document.body.appendChild(tempDom)
|
|
|
+ tempDom.select()
|
|
|
+ tempDom.setSelectionRange(0, 9999)
|
|
|
+ document.execCommand('Copy')
|
|
|
+ document.body.removeChild(tempDom)
|
|
|
+ },
|
|
|
+ showToast(contentStr) {
|
|
|
+ const toastNode = document.createElement('div')
|
|
|
+ toastNode.style.position = 'fixed'
|
|
|
+ toastNode.style.left = '50%'
|
|
|
+ toastNode.style.top = '50%'
|
|
|
+ toastNode.style.transform = 'translate(-50%, -50%)'
|
|
|
+ toastNode.style.backgroundColor = '#555'
|
|
|
+ toastNode.style.borderRadius = '0.5rem'
|
|
|
+ toastNode.style.padding = '1.67rem'
|
|
|
+ toastNode.style.minWidth = '33vw'
|
|
|
+ toastNode.style.color = '#fff'
|
|
|
+ toastNode.style.fontSize = '1.67rem'
|
|
|
+ toastNode.style.zIndex = globalConfig.zIndex.toast.self
|
|
|
+ toastNode.style.display = 'flex'
|
|
|
+ toastNode.style.flexDirection = 'column'
|
|
|
+ toastNode.style.justifyContent = 'center'
|
|
|
+ toastNode.style.alignItems = 'center'
|
|
|
+ toastNode.innerText = contentStr
|
|
|
+ document.body.appendChild(toastNode)
|
|
|
+ setTimeout(() => {
|
|
|
+ document.body.removeChild(toastNode)
|
|
|
+ }, 1700)
|
|
|
+ }
|
|
|
}
|