docs(quickstart): update cdn guide (#4456)

This commit is contained in:
neverland
2019-09-14 11:10:23 +08:00
committed by GitHub
parent 4f4608232c
commit 3c761cec1e
2 changed files with 21 additions and 17 deletions
+10 -8
View File
@@ -93,23 +93,25 @@ Vue.use(Vant);
### 4. CDN
The easiest way to use Vant is to include a CDN link in the html file, after which you can access all components via the global variable `vant`.
```html
<!-- import style -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vant@2.2/lib/index.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vant@2.2/lib/index.css">
<!-- import script -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vant@2.2/lib/vant.min.js"></script>
<script>
var Vue = window.Vue;
var vant = window.vant;
// Render the Button component
new Vue({
el: '#app',
template: `<van-button>Button</van-button>`
});
// Register Lazyload component
Vue.use(vant.Lazyload);
// Call function components
vant.Toast('message');
// Call function component
vant.Toast('Message');
</script>
```