mirror of
https://github.com/Hopiu/vue-material.git
synced 2026-05-13 09:43:15 +00:00
190 lines
7.2 KiB
Vue
190 lines
7.2 KiB
Vue
<template>
|
|
<page-content page-title="Getting Started">
|
|
<div class="main-content">
|
|
<article>
|
|
<section>
|
|
<h2 class="md-headline">Include Fonts and Icons</h2>
|
|
|
|
<p>Use Roboto and Google Icons from Google CDN:</p>
|
|
<code-block lang="xml">
|
|
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic">
|
|
<link rel="stylesheet" href="//fonts.googleapis.com/icon?family=Material+Icons">
|
|
</code-block>
|
|
</section>
|
|
</article>
|
|
|
|
<article>
|
|
<h2 class="md-headline">Installation</h2>
|
|
|
|
<section>
|
|
<h3 class="md-title">NPM</h3>
|
|
<p>Install Vue Material through npm or yarn <br><small>* Others package managers like JSPM and Bower are not supported yet.</small></p>
|
|
<code-block lang="bash">
|
|
$ npm install vue-material --save
|
|
$ yarn add vue-material
|
|
</code-block>
|
|
</section>
|
|
|
|
<section>
|
|
<h3 class="md-title">Standalone</h3>
|
|
<p>Download from Github and reference the script and the stylesheet in your HTML:</p>
|
|
<md-button class="md-raised md-primary" href="https://github.com/marcosmoura/vue-material/archive/master.zip" target="_blank" rel="noopener">download</md-button>
|
|
</section>
|
|
</article>
|
|
|
|
<article>
|
|
<h2 class="md-headline">Usage</h2>
|
|
|
|
<section>
|
|
<h3 class="md-title">AMD Modules</h3>
|
|
|
|
<p>Import and use the whole library:</p>
|
|
<code-block lang="xml">
|
|
<link rel="stylesheet" href="path/to/vue-material.css">
|
|
</code-block>
|
|
|
|
<code-block lang="javascript">
|
|
var Vue = require('vue')
|
|
var VueMaterial = require('vue-material')
|
|
|
|
Vue.use(VueMaterial)
|
|
</code-block>
|
|
|
|
<p>Or to import individual components:</p>
|
|
<code-block lang="xml">
|
|
<link rel="stylesheet" href="path/to/vue-material/dist/components/mdCore.css">
|
|
<link rel="stylesheet" href="path/to/vue-material/dist/components/mdButton.css">
|
|
<link rel="stylesheet" href="path/to/vue-material/dist/components/mdIcon.css">
|
|
<link rel="stylesheet" href="path/to/vue-material/dist/components/mdSidenav.css">
|
|
<link rel="stylesheet" href="path/to/vue-material/dist/components/mdToolbar.css">
|
|
</code-block>
|
|
|
|
<code-block lang="javascript">
|
|
var Vue = require('vue')
|
|
var VueMaterial = require('vue-material')
|
|
|
|
Vue.use(VueMaterial.mdCore) //Required to boot vue material
|
|
Vue.use(VueMaterial.mdButton)
|
|
Vue.use(VueMaterial.mdIcon)
|
|
Vue.use(VueMaterial.mdSidenav)
|
|
Vue.use(VueMaterial.mdToolbar)
|
|
</code-block>
|
|
|
|
<p><strong>Note:</strong> If you are using Webpack you can still import the css files inside your modules. And you can also write everything using ES6 with Babel or Bublé.</p>
|
|
</section>
|
|
|
|
<section>
|
|
<h3 class="md-title">Standalone</h3>
|
|
|
|
<code-block lang="xml">
|
|
<link rel="stylesheet" href="path/to/vue-material.css">
|
|
<script src="path/to/vue-material.js"></script>
|
|
</code-block>
|
|
|
|
<code-block lang="javascript">
|
|
// The VueMaterial variable is global
|
|
Vue.use(VueMaterial)
|
|
</code-block>
|
|
</section>
|
|
</article>
|
|
|
|
<article>
|
|
<section>
|
|
<h2 class="md-headline">Themes</h2>
|
|
|
|
<p>To get Vue Material working properly, you'll need to configure a default theme. You can also register multiple themes at once. Apply your theme on each code part that you want using <code>v-md-theme</code> directive:</p>
|
|
|
|
<md-tabs :md-dynamic-height="false" class="md-transparent">
|
|
<md-tab md-label="Single Theme">
|
|
<code-block lang="javascript">
|
|
Vue.material.theme.register('default', {
|
|
primary: 'cyan',
|
|
accent: 'pink'
|
|
})
|
|
</code-block>
|
|
|
|
<code-block lang="xml">
|
|
<div id="app" v-md-theme="'default'">
|
|
<md-toolbar>
|
|
<div class="md-title">My App</div>
|
|
</md-toolbar>
|
|
|
|
<md-button>My Button</md-button>
|
|
</div>
|
|
</code-block>
|
|
</md-tab>
|
|
|
|
<md-tab md-label="Multiple Themes">
|
|
<code-block lang="javascript">
|
|
Vue.material.theme.registerAll({
|
|
default: {
|
|
primary: 'cyan',
|
|
accent: 'pink'
|
|
},
|
|
indigo: {
|
|
primary: 'indigo',
|
|
accent: 'pink'
|
|
}
|
|
})
|
|
</code-block>
|
|
|
|
<code-block lang="xml">
|
|
<div id="app" v-md-theme="'default'">
|
|
<md-toolbar>
|
|
<div class="md-title">My App</div>
|
|
</md-toolbar>
|
|
|
|
<md-button v-md-theme="'indigo'">My Button</md-button>
|
|
</div>
|
|
</code-block>
|
|
</md-tab>
|
|
</md-tabs>
|
|
</section>
|
|
</article>
|
|
|
|
<article>
|
|
<h2 class="md-headline">Codepen Examples</h2>
|
|
|
|
<section>
|
|
<h3 class="md-title">Playground</h3>
|
|
<iframe height="620" scrolling="no" title="Empty Setup" src="//codepen.io/vue-material/embed/VmMrYW/?height=620&theme-id=dark&default-tab=html,result&embed-version=2" frameborder="no" allowtransparency="true" allowfullscreen="true" style="width: 100%;">See the Pen <a href="http://codepen.io/vue-material/pen/VmMrYW/">Empty Setup</a> by Vue Material (<a href="http://codepen.io/vue-material">@vue-material</a>) on <a href="http://codepen.io">CodePen</a>.</iframe>
|
|
</section>
|
|
|
|
<section>
|
|
<h3 class="md-title">File Application UI</h3>
|
|
<iframe width="360" height="610" scrolling="no" title="File Application UI" src="//codepen.io/vue-material/embed/WoZpMR/?height=610&theme-id=dark&default-tab=result&embed-version=2" frameborder="no" allowtransparency="true" allowfullscreen="true">See the Pen <a href="http://codepen.io/vue-material/pen/WoZpMR/">Vue Material Example</a> by Vue Material (<a href="http://codepen.io/vue-material">@vue-material</a>) on <a href="http://codepen.io">CodePen</a>.</iframe>
|
|
</section>
|
|
</article>
|
|
</div>
|
|
</page-content>
|
|
</template>
|
|
|
|
<style lang="scss" scoped>
|
|
.main-content {
|
|
position: relative;
|
|
}
|
|
|
|
article {
|
|
max-width: 960px;
|
|
}
|
|
|
|
section + section,
|
|
article + article {
|
|
margin-top: 36px;
|
|
}
|
|
|
|
.code-block,
|
|
.md-tabs {
|
|
max-width: 100%;
|
|
}
|
|
|
|
.md-tab {
|
|
border-top: 1px solid rgba(#000, .12);
|
|
padding: 0;
|
|
}
|
|
|
|
iframe {
|
|
height: auto;
|
|
min-height: 620px;
|
|
}
|
|
</style>
|