How to use the @material/switch/foundation function in @material/switch

To help you get started, we’ve selected a few @material/switch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pgbross / vue-material-adapter / packages / mcwv-switch / switch.js View on Github external
mounted() {
    this.foundation = new MDCSwitchFoundation({
      addClass: className => this.$set(this.classes, className, true),
      removeClass: className => this.$delete(this.classes, className),
      setNativeControlChecked: checked => (this.nativeControlChecked = checked),
      setNativeControlDisabled: disabled =>
        (this.nativeControlDisabled = disabled),
    });
    this.foundation.init();
    this.foundation.setChecked(this.checked);
    this.foundation.setDisabled(this.disabled);

    this.ripple = new RippleBase(this);
    this.ripple.init();
  },
  beforeDestroy() {
github pgbross / vue-material-adapter / packages / mcwv-switch / mdc-switch.js View on Github external
mounted() {
    this.foundation = new MDCSwitchFoundation({
      addClass: className => this.$set(this.classes, className, true),
      removeClass: className => this.$delete(this.classes, className),
      setNativeControlChecked: checked => (this.nativeControlChecked = checked),
      setNativeControlDisabled: disabled =>
        (this.nativeControlDisabled = disabled),
    });
    this.foundation.init();
    this.foundation.setChecked(this.checked);
    this.foundation.setDisabled(this.disabled);

    this.ripple = new RippleBase(this);
    this.ripple.init();
  },
  beforeDestroy() {