OSDN Git Service

feat coby
authorxuhongxin <xuhongxin@luojilab.com>
Thu, 18 Oct 2018 15:28:25 +0000 (23:28 +0800)
committerxuhongxin <xuhongxin@luojilab.com>
Thu, 18 Oct 2018 15:28:25 +0000 (23:28 +0800)
package-lock.json
package.json
src/popup/home/main.vue
src/popup/index.js

index dc7709e..d3b295f 100644 (file)
       "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz",
       "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk="
     },
+    "clipboard": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.1.tgz",
+      "integrity": "sha512-7yhQBmtN+uYZmfRjjVjKa0dZdWuabzpSKGtyQZN+9C8xlC788SSJjOHWh7tzurfwTqTD5UDYAhIv5fRJg3sHjQ==",
+      "requires": {
+        "good-listener": "1.2.2",
+        "select": "1.1.2",
+        "tiny-emitter": "2.0.2"
+      }
+    },
     "cliui": {
       "version": "3.2.0",
       "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz",
       "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
       "dev": true
     },
+    "delegate": {
+      "version": "3.2.0",
+      "resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz",
+      "integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw=="
+    },
     "delegates": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
         "minimatch": "3.0.4"
       }
     },
+    "good-listener": {
+      "version": "1.2.2",
+      "resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz",
+      "integrity": "sha1-1TswzfkxPf+33JoNR3CWqm0UXFA=",
+      "requires": {
+        "delegate": "3.2.0"
+      }
+    },
     "graceful-fs": {
       "version": "4.1.11",
       "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz",
         }
       }
     },
+    "select": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz",
+      "integrity": "sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0="
+    },
     "select-hose": {
       "version": "2.0.0",
       "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz",
         "setimmediate": "1.0.5"
       }
     },
+    "tiny-emitter": {
+      "version": "2.0.2",
+      "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.0.2.tgz",
+      "integrity": "sha512-2NM0auVBGft5tee/OxP4PI3d8WItkDM+fPnaRAVo6xTDI2knbz9eC5ArWGqtGlYqiH3RU5yMpdyTTO7MguC4ow=="
+    },
     "tinycolor2": {
       "version": "1.4.1",
       "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.1.tgz",
index d8d9de6..579164a 100644 (file)
@@ -15,6 +15,7 @@
     "axios": "^0.18.0",
     "babel-preset-es2015": "^6.24.1",
     "bytom-js-sdk": "^1.3.3",
+    "clipboard": "^2.0.1",
     "file-saver": "^2.0.0-rc.3",
     "iview": "^3.0.0",
     "moment": "^2.22.2",
index 097814a..7c72faa 100644 (file)
@@ -91,6 +91,9 @@
   right: 20px;
   margin-top: 13px;
 }
+.account-address {
+  cursor: pointer
+}
 </style>
 
 <template>
           <img src="../../assets/logo.png" class="token-icon">
           <div class="amount">
               <div class="token-amount">{{accountInfo.balance}} BTM</div>
-              <p class="account-address">{{accountInfo.address_short}}<i class="iconfont qrcode" @click="showQrcode">&#xe7dd;</i></p>
+              <p
+                :data-clipboard-text="accountInfo.address"
+                :title="addressTitle" 
+                class="account-address">
+                {{accountInfo.address_short}}
+                <i class="iconfont qrcode" @click="showQrcode">&#xe7dd;</i>
+              </p>
           </div>
           <a href="#" class="btn btn-primary btn-transfer" @click="transferOpen">转账</a>
       </div>
@@ -163,6 +172,7 @@ export default {
   },
   data() {
     return {
+      addressTitle: "点击复制地址",
       menuOpen: false,
       maskOpen: false,
       accountInfo: {},
index 16e50b1..5423c03 100644 (file)
@@ -2,9 +2,17 @@ import Vue from "vue";
 import App from "./App.vue";
 import Loading from 'vue-loading-overlay';
 import moment from "moment";
+import ClipboardJS from "clipboard";
 import "../assets/style.css";
 import 'vue-loading-overlay/dist/vue-loading.css';
 
+let clipboard = new ClipboardJS(".account-address");
+clipboard.on('success', function(e) {
+  alert("coby success");
+});
+clipboard.on('error', function(e) {
+  alert("coby error");
+});
 Vue.use(Loading);
 Vue.filter("moment", function(value, formatString) {
   formatString = formatString || "YYYY-MM-DD HH:mm:ss";