Home  >  Article  >  Web Front-end  >  Reference bmob js-sdk in VUE (detailed tutorial)

Reference bmob js-sdk in VUE (detailed tutorial)

亚连
亚连Original
2018-06-11 12:02:482628browse

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. Let me share with you the tutorial on using bmob js-sdk in vue through this article. Friends who need it can refer to it

Introduction of BmobSDK

Place bmob js-sdk in the static directory, and then introduce it in the form of a script tag in the index.html page. 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 new js folder in the assets directory , and then create key.js to store the bmob application key

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

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)
})

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future. .

Related articles:

How to solve the problem of niceScroll scroll bar misalignment in jQuery

How to implement Baidu search interface in JS

How to implement the double-color ball function in JS

How to implement the snow animation effect in jQuery

How to achieve the pull-down refresh and pull-up loading effect of the list in the WeChat applet?

How to use the digital scrolling plug-in in the WeChat mini program

How to achieve the text marquee effect in the WeChat mini program

The above is the detailed content of Reference bmob js-sdk in VUE (detailed tutorial). 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