Home  >  Article  >  Web Front-end  >  Sharing tutorial examples of using bmob js-sdk in vue

Sharing tutorial examples of using bmob js-sdk in vue

小云云
小云云Original
2018-01-24 10:49:561625browse

Put bmob js-sdk in the static directory, and then introduce it in the form of a script tag in the index.html page, and you can use bmob js-sdk globally in vue. This article mainly shares with you the tutorial on using bmob js-sdk in vue. Friends who need it can refer to it. I hope it can help everyone.

Introduction of BmobSDK

Place bmob js-sdk in the static directory, and then add the script tag to the index.html page Introduced in the form, you can use bmob js-sdk globally in vue


<!DOCTYPE html>
<html>
 <head>
  <meta charset="utf-8">
  <title></title>
  <script src="static/bmob-min.js"></script>
 </head>
 <body>
  <p id="app"></p>
 </body>
</html>

Create a js folder in the assets directory, and then create key.js to store bmob Use key


Bmob.initialize("你的Application ID", "你的REST API Key");

to introduce key.js into main.js. The introduction of bmobsdk is complete. Now you can request a piece of data to celebrate. [If you need to use bmob for a single js file in a Vue project, you need to introduce key.js, or fill in the bmob application key]


##

import Vue from &#39;vue&#39;
import App from &#39;./App&#39;
import router from &#39;./router&#39;
import &#39;./assets/js/key&#39; //引入bmob js-sdk
Vue.config.productionTip = false
new Vue({
 el: &#39;#app&#39;,
 router,
 render: h => h(App)
})

Related recommendations:


Implement Node.js in WeChat JS-SDK backend interface

Detailed explanation of WeChat JS-SDK development scan interface function implementation code

WeChat JS-SDK image interface development

The above is the detailed content of Sharing tutorial examples of using bmob js-sdk in vue. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn