From 601a809601a875cbe3bc30349ecd18a223a64f26 Mon Sep 17 00:00:00 2001 From: monky Date: Tue, 28 Aug 2018 01:03:50 +0800 Subject: [PATCH] install js-sdk --- package-lock.json | 8 ++++++++ package.json | 1 + src/content/index.js | 24 ------------------------ src/popup/App.vue | 29 +++++++++++++++++++++++++---- src/popup/framework/home.vue | 13 ------------- src/popup/index.js | 12 +++++++----- 6 files changed, 41 insertions(+), 46 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0e919f8..0327b38 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1477,6 +1477,14 @@ "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=", "dev": true }, + "bytom-js-sdk": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/bytom-js-sdk/-/bytom-js-sdk-1.0.1.tgz", + "integrity": "sha512-m/w7FoTIeh7b6rG3QYjycPm2i84tbs6FCG5NtejIToIhEK0FLEY13RSJ9EkA/oQ6WMXeRbVVZb4e4JylVl9Gig==", + "requires": { + "axios": "0.18.0" + } + }, "cacache": { "version": "10.0.4", "resolved": "https://registry.npmjs.org/cacache/-/cacache-10.0.4.tgz", diff --git a/package.json b/package.json index d64bd26..109173e 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "dependencies": { "axios": "^0.18.0", "babel-preset-es2015": "^6.24.1", + "bytom-js-sdk": "^1.0.1", "iview": "^3.0.0", "vue": "^2.5.11" }, diff --git a/src/content/index.js b/src/content/index.js index 60c93a2..66b2f34 100644 --- a/src/content/index.js +++ b/src/content/index.js @@ -1,25 +1 @@ -// import bytom from "bytom-js-sdk" - -// //install -// //npm link your_local_path_bytom-js-sdk -// //npm link bytom-js-sdk -// const url = 'http://127.0.0.1:9888' -// const accessToken = '' - -// const client = new bytom(url, accessToken) - -// //create key -// const keyPromise = client.keys.create('alias', 'password') -// keyPromise.then(key => { -// console.log(key) -// }).catch(function(error){ -// console.log(error) -// }) - -// //accounts list -// const acPromise = client.accounts.listAll() -// acPromise.then(res => { -// console.log(res) -// }) - console.log('This is CONTENT page!') diff --git a/src/popup/App.vue b/src/popup/App.vue index 437c809..7a6f321 100644 --- a/src/popup/App.vue +++ b/src/popup/App.vue @@ -11,14 +11,16 @@ import Home from "./framework/home"; import Login from "./framework/login"; +import Bytom from "bytom-js-sdk"; + export default { components: { Login, - Home, + Home }, data() { return { - currView: "home", + currView: "home" }; }, computed: { @@ -26,11 +28,30 @@ export default { const { currView } = this; return { login: currView === "login", - home: currView === "home", + home: currView === "home" }; } }, - methods: { + methods: {}, + mounted() { + const url = "http://127.0.0.1:9888"; + const accessToken = ""; + + const client = new Bytom(url, accessToken); + + //create key + // const keyPromise = client.keys.create('alias', 'password') + // keyPromise.then(key => { + // console.log(key) + // }).catch(function(error){ + // console.log(error) + // }) + + //accounts list + const acPromise = client.accounts.listAll(); + acPromise.then(res => { + console.log(res); + }); } }; \ No newline at end of file diff --git a/src/popup/framework/home.vue b/src/popup/framework/home.vue index 17a9421..e298a1c 100644 --- a/src/popup/framework/home.vue +++ b/src/popup/framework/home.vue @@ -187,19 +187,6 @@ export default { showQrcode: function() {} }, mounted() { - // const url = 'http://127.0.0.1:9888' - // const accessToken = '' - // const client = new bytom(url, accessToken) - // //create key - // const keyPromise = client.keys.create('alias', 'password') - // keyPromise.then(key => { - // console.log(key) - // }) - // //accounts list - // const acPromise = client.accounts.listAll() - // acPromise.then(res => { - // console.log(res) - // }) // this.openMenu() } }; diff --git a/src/popup/index.js b/src/popup/index.js index 2e03f86..656630f 100644 --- a/src/popup/index.js +++ b/src/popup/index.js @@ -1,8 +1,10 @@ -import Vue from 'vue' -import App from './App.vue' -import '../assets/style.css'; +import Vue from "vue"; +import App from "./App.vue"; +import "../assets/style.css"; + +// Vue.use(Bytom); new Vue({ - el: '#app', + el: "#app", render: h => h(App) -}) +}); -- 2.11.0