textCopy: function(text) {
return new Promise(function(resolve, reject) {
if (text) {
const txt = document.createElement("textarea");
document.body.appendChild(txt);
txt.value = text; // chrome uses this
let sel = getSelection();
let range = document.createRange();
range.selectNode(txt);
sel.removeAllRanges();
sel.addRange(range);
if (document.execCommand("copy")) {
console.log("copied");
}
document.body.removeChild(txt);
alert("복사 되었습니다.\n붙여넣기(ctrl+v)로 사용하세요.");
resolve();
} else {
reject(Error("복사 실패"));
}
});
},
'개발이야기 > Vue - Vuetify' 카테고리의 다른 글
[Vue warn]: Failed to resolve directive: ripple 해결 (0) | 2021.01.20 |
---|---|
v-data-table 헤더 변경 (0) | 2021.01.19 |
v-file-input 이미지 사이즈 확인 (0) | 2020.12.27 |
vue 부모에서 자식 컴포넌트 호출 (0) | 2020.11.26 |
vuetify v-data-table paging (0) | 2020.11.25 |