mirror of https://github.com/IoTcat/sakura2.git
parent
6dc4eccd56
commit
a11067364d
8 changed files with 89 additions and 20 deletions
@ -1,22 +1,33 @@ |
||||
/** |
||||
* Copyright 2019 Mashiro |
||||
* @description material-components initial |
||||
* @author Mashiro |
||||
* @since 19/11/1 |
||||
* @license MIT |
||||
*/ |
||||
|
||||
import { MDCRipple } from '@material/ripple' |
||||
import { MDCTextField } from '@material/textfield' |
||||
import { MDCTopAppBar } from '@material/top-app-bar' |
||||
|
||||
export default function () { |
||||
// const textField = new MDCTextField(document.querySelector('.mdc-text-field'))
|
||||
|
||||
//const ripple = new MDCRipple(document.querySelector('.mdc-button'))
|
||||
MDCRipple.attachTo(document.querySelector('.demo-card__primary-action')) |
||||
MDCRipple.attachTo(document.querySelector('.mdc-button')) |
||||
|
||||
// const topAppBar = new MDCTopAppBar(document.querySelector('.mdc-top-app-bar'))
|
||||
/* See https://git.io/JegHJ */ |
||||
/* use once (single <HTMLElement>) */ |
||||
// MDCRipple.attachTo(document.querySelector('.mdc-button'))
|
||||
// const buttonRipple = new MDCRipple(document.querySelector('.mdc-button'))
|
||||
|
||||
/* use to all (map <NodeList>) */ |
||||
// for several classes
|
||||
const rippleList = [] |
||||
rippleList.push('.mdc-button','.demo-card__primary-action', ".something") |
||||
const mdcRipple = [].map.call(document.querySelectorAll(rippleList.join(',')), function (e: any) { |
||||
return new MDCRipple(e) |
||||
}) |
||||
|
||||
const textField = [].map.call(document.querySelectorAll('.mdc-text-field'), function (el) { |
||||
return new MDCTextField(el) |
||||
// for specified class
|
||||
const topAppBar = [].map.call(document.querySelectorAll('.mdc-top-app-bar'), function (e: any) { |
||||
return new MDCTopAppBar(e) |
||||
}) |
||||
const textField = [].map.call(document.querySelectorAll('.mdc-text-field'), function (e: any) { |
||||
return new MDCTextField(e) |
||||
}) |
||||
} |
Loading…
Reference in new issue