项目作者: arabsight

项目描述 :
MDC (Material Design UI Components) plugin for Aurelia.
高级语言: JavaScript
项目地址: git://github.com/arabsight/aurelia-mdc-plugin.git
创建时间: 2017-01-08T13:11:09Z
项目社区:https://github.com/arabsight/aurelia-mdc-plugin

开源协议:MIT License

下载


aurelia-mdc-plugin

NPM

Aurelia CLI:

  • Install:
  1. npm i -S material-components-web
  2. npm i -S aurelia-mdc-plugin
  • Bundle with Aurelia-CLI (requirejs):

add mdc & plugin to one of your bundle’s dependencies in aurelia.json.

  1. {
  2. "name": "material-components-web",
  3. "path": "../node_modules/material-components-web/dist",
  4. "main": "material-components-web",
  5. "resources": [
  6. "material-components-web.css"
  7. ]
  8. },
  9. {
  10. "name": "aurelia-mdc-plugin",
  11. "path": "../node_modules/aurelia-mdc-plugin/dist/amd",
  12. "main": "index"
  13. }
  • Register the plugin:
  1. export function configure(aurelia) {
  2. ...
  3. aurelia.use.plugin('aurelia-mdc-plugin');
  4. ...
  5. }

with WebPack:

  1. aurelia.use.plugin(PLATFORM.moduleName('aurelia-mdc-plugin'));
  • import the css:
  1. <require from="material-components-web/material-components-web.css"></require>
  • Use it!
  1. <button class="mdc-button
  2. mdc-button--raised
  3. mdc-button--primary
  4. mdc-ripple-surface">
  5. Print Greeting
  6. </button>
  • Add new or 3rd party MDC-web components:
  1. aurelia.use.plugin('aurelia-mdc-plugin', mdc => mdc.addComponents({
  2. 'mdc-selector': 'MDCClassName'
  3. }));

The plugin automaticaly adds data-mdc-auto-init=”MDCRipple” to the button above and initializes it, so you do not have to add it to any of the components available.