|
@@ -41,6 +41,20 @@ new Vue({
|
|
|
|
|
|
getResult: function () {
|
|
|
this.$refs.rstCode.select();
|
|
|
+ },
|
|
|
+
|
|
|
+ copyResult: function () {
|
|
|
+ // 选中要复制的内容
|
|
|
+ this.getResult();
|
|
|
+
|
|
|
+ if ('clipboard' in navigator) {
|
|
|
+ navigator.clipboard.writeText(this.resultContent)
|
|
|
+ .catch(err => {
|
|
|
+ console.error('复制失败: ', err);
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ alert("您的浏览器不支持 clipboard API, 请手动复制")
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
});
|