docs(quickstart): update cdn guide (#4456)
This commit is contained in:
@@ -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>
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user