Sha256: 7d8146e74e65e48ebbbb57eef17adb755e9c26b16de7e31dabe5b2b63c10cb18

Contents?: true

Size: 586 Bytes

Versions: 47

Compression:

Stored size: 586 Bytes

Contents

export default function paramsInputComponent({ name, value }) {
  return {
    name,
    value,

    init() {
      this.$watch("value", () => this.update());
    },

    update() {
      if (this.validate()) {
        const searchParams = new URLSearchParams(window.location.search);
        searchParams.set(this.name, this.value);
        const path = location.href.replace(location.search, "");
        this.navigateTo(`${path}?${searchParams.toString()}`);
      }
    },

    validate() {
      return this.$root.reportValidity ? this.$root.reportValidity() : true;
    },
  };
}

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
lookbook-2.0.0.beta.9 assets/js/components/params_input.js
lookbook-2.0.0.beta.8 assets/js/components/params_input.js
lookbook-2.0.0.beta.7 assets/js/components/params_input.js
lookbook-2.0.0.beta.5 app/assets/lookbook/js/components/params_input.js
lookbook-2.0.0.beta.4 app/assets/lookbook/js/components/params_input.js
lookbook-2.0.0.beta.3 app/assets/lookbook/js/components/params_input.js
lookbook-2.0.0.beta.2 app/assets/lookbook/js/components/params_input.js
lookbook-1.5.3 app/assets/lookbook/js/components/params_input.js
lookbook-2.0.0.beta.1 app/assets/lookbook/js/components/params_input.js
lookbook-1.5.2 app/assets/lookbook/js/components/params_input.js
lookbook-2.0.0.beta.0 app/assets/lookbook/js/components/params_input.js
lookbook-1.5.1 app/assets/lookbook/js/components/params_input.js
lookbook-1.5.0 app/assets/lookbook/js/components/params_input.js
lookbook-1.4.5 app/assets/lookbook/js/components/params_input.js
lookbook-1.4.4 app/assets/lookbook/js/components/params_input.js
lookbook-1.4.3 app/assets/lookbook/js/components/params_input.js
lookbook-1.4.2 app/assets/lookbook/js/components/params_input.js
lookbook-1.4.1 app/assets/lookbook/js/components/params_input.js
lookbook-1.4.0 app/assets/lookbook/js/components/params_input.js
lookbook-1.3.4 app/assets/lookbook/js/components/params_input.js