From 1b3cddd6e7adfeb24fa4388506e2a1dc533be637 Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 10 Jun 2024 12:00:18 -0500 Subject: [PATCH] feat: Correcciones --- .eslintrc.js | 101 +++++++++++------- src/components/products/product-in-car.vue | 33 +++--- .../shared/buttons/quantity-button.vue | 13 ++- 3 files changed, 90 insertions(+), 57 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 253f6a52..f81a262f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,42 +1,69 @@ // http://eslint.org/docs/user-guide/configuring module.exports = { - root: true, - parser: 'babel-eslint', - parserOptions: { - sourceType: 'module' - }, - env: { - browser: true, - }, - extends: 'airbnb-base', - // required to lint *.vue files - plugins: [ - 'html' - ], - // check if imports actually resolve - 'settings': { - 'import/resolver': { - 'webpack': { - 'config': 'build/webpack.base.conf.js' - } - } - }, - // add your custom rules here - 'rules': { - // don't require .vue extension when importing - 'import/extensions': ['error', 'always', { - 'js': 'never', - 'vue': 'never' - }], - // allow optionalDependencies - "linebreak-style": 0, - 'import/no-extraneous-dependencies': ['error', { - 'optionalDependencies': ['test/unit/index.js'] - }], - // allow debugger during development + root: true, + parser: 'babel-eslint', + parserOptions: { + sourceType: 'module', + }, + env: { + browser: true, + }, + extends: 'airbnb-base', + // required to lint *.vue files + plugins: ['html'], + // check if imports actually resolve + settings: { + 'import/resolver': { + webpack: { + config: 'build/webpack.base.conf.js', + }, + }, + }, + // add your custom rules here + rules: { + 'comma-dangle': 'off', + 'arrow-parens': ['off', 'off'], // Desactiva la regla o ajusta según tu preferencia + 'import/no-extraneous-dependencies': 'off', // Desactiva la regla import/no-extraneous-dependencies + 'no-mixed-operators': 'off', // Activar la regla no-mixed-operators + indent: 'off', // Indentación con tabs + 'no-mixed-spaces-and-tabs': 'off', // Evitar mezcla de espacios y tabs + // 'indent': ['error', 'tab'], // Indentación con tabs + 'max-len': [ + 'error', + { + code: 120, + ignoreStrings: true, + ignoreTemplateLiterals: true, + ignoreComments: true, // Ignorar longitud de línea en comentarios largos + ignoreUrls: true, // Ignorar longitud de línea en URLs largas + ignoreRegExpLiterals: true, // Ignorar longitud de línea en expresiones regulares largas + ignorePattern: '^[ \t]*<(\\w+)([^>]*)>(.|\n)*?<\\/\\1>', // Ignorar líneas dentro de JSX + ignorePattern: '^\\s*\\{', // Ignorar líneas dentro de objetos de configuración largos + }, + ], + // don't require .vue extension when importing + 'import/extensions': [ + 'error', + 'always', + { + js: 'never', + vue: 'never', + }, + ], + // allow optionalDependencies + 'import/no-extraneous-dependencies': [ + 'error', + { + optionalDependencies: ['test/unit/index.js'], + }, + ], + 'linebreak-style': ['error', 'windows'], + // allow debugger during development 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, 'no-tabs': 0, - 'indent': ['error', 'tab'] - } -} + // 'indent': 'off', + // 'no-mixed-spaces-and-tabs': 'off', + 'linebreak-style': 0, + }, +}; diff --git a/src/components/products/product-in-car.vue b/src/components/products/product-in-car.vue index 3ea4e757..6b016a02 100644 --- a/src/components/products/product-in-car.vue +++ b/src/components/products/product-in-car.vue @@ -167,26 +167,29 @@ function showComments() { function inputQuantity(value) { this.product.quantity = Number(value); + this.clickQuantity(); } function clickQuantity(val) { let { quantity } = this.product; const { unit } = this.product; - if (this.product.category.type === 2) { - this.opt = { - more: 0.1, - less: -0.1, - }; - quantity += this.opt[val]; - quantity = +quantity.toFixed(2); - quantity = quantity < 0.1 ? 0.1 : quantity; - } else { - this.opt = { - more: 1, - less: -1, - }; - quantity += this.opt[val]; - quantity = quantity < 1 ? 1 : quantity; + if (val) { + if (this.product.id === 3581799) { + this.opt = { + more: 0.1, + less: -0.1, + }; + quantity += this.opt[val]; + quantity = +quantity.toFixed(2); + quantity = quantity < 0.1 ? 0.1 : quantity; + } else { + this.opt = { + more: 1, + less: -1, + }; + quantity += this.opt[val]; + quantity = quantity < 1 ? 1 : quantity; + } } this.quantityStock = parseInt(unit.quantity * quantity, 10); if (this.showUnity) { diff --git a/src/components/shared/buttons/quantity-button.vue b/src/components/shared/buttons/quantity-button.vue index bb819132..ab1ff929 100644 --- a/src/components/shared/buttons/quantity-button.vue +++ b/src/components/shared/buttons/quantity-button.vue @@ -11,7 +11,7 @@ v-if="product.category.type === 2" class="input-number" type="number" - :value="number" + v-model="number" @input="$emit('input', $event.target.value )" >