Comments (6)
没能复现这个问题,需要提供一下最小化的可复现 demo。
from varlet.
找到问题了,是表单内传给input的验证规则引起的
<var-input
v-model="model.username"
:placeholder="$t('page.login.common.userNamePlaceholder')"
:rules="new Rules().required().value"
size="small"
variant="outlined"
>
<template #prepend-icon>
<var-icon name="account-circle"/>
</template>
</var-input>
export class Rules {
rules = []
get value() {
return this.rules;
}
required(errorMessage = '不能为空') {
this.rules.push((v) => {
if (v === null || v === undefined) return errorMessage;
if (typeof v === 'string' && v.trim() === '') return errorMessage;
if (Array.isArray(v) && v.length === 0) return errorMessage;
if (typeof v === 'object' && !Array.isArray(v) && Object.keys(v).length === 0) return errorMessage;
return true;
});
return this;
}
}
from varlet.
from varlet.
午休了,下午整一个
from varlet.
抱歉,水平有限,起新项目实在是复现不出来,总而言之换了种导出方式后问题解决了(还是一样,开发时正常,生产环境才出问题),可能是打包时类名压缩啥的出的问题,所以新项目不会出现。
class formRules{
rules = []
get value() {
return this.rules;
}
required(errorMessage = '不能为空') {
this.rules.push((v) => {
if (v === null || v === undefined) return errorMessage;
if (typeof v === 'string' && v.trim() === '') return errorMessage;
if (Array.isArray(v) && v.length === 0) return errorMessage;
if (typeof v === 'object' && !Array.isArray(v) && Object.keys(v).length === 0) return errorMessage;
return true;
});
return this;
}
}
export const Rules = new formRules();
<var-form ref="formRef">
<var-space
direction="column"
size="5vmin"
>
<var-input
v-model="model.username"
:placeholder="$t('page.login.common.userNamePlaceholder')"
:rules="Rules.required().value"
size="small"
variant="outlined"
@keydown.enter="handleSubmit"
>
<template #prepend-icon>
<var-icon name="account-circle"/>
</template>
</var-input>
<var-input
v-model="model.password"
:placeholder="$t('page.login.common.passwordPlaceholder')"
:rules="Rules.required().value"
size="small"
type="password"
variant="outlined"
@keydown.enter="handleSubmit"
>
<template #prepend-icon>
<var-icon name="lock"/>
</template>
</var-input>
</var-space>
</var-form>
from varlet.
这种现象很像是构建触发了 tree-shaking 导致部分代码被摇掉了。这个 issue 暂时开启一段时间,有问题可以留在这边。
from varlet.
Related Issues (20)
- Nuxt3中DatePicker组件国际化无效 HOT 1
- add ripple prop for menuOption component
- Fab调整 菜单展开方式 HOT 6
- Picker Light Theme 中有CSS语法错误 HOT 1
- Use `v-model.trim="value"` in `input`, can't enter space. HOT 1
- 设置了input 为readonly 导致无法正确校验 HOT 4
- input 组件,能否支持输入小数 HOT 3
- [Feature] Support default slot which has the margin and padding of title and the font style of description for card component
- [Feature] support choosing city without region for picker component HOT 2
- [Improvement] remove useless common style and add namespace for some styles
- 3.3.8 版本Popup.mjs:33:21提示ReferenceError: defineComponent is not defined HOT 5
- xxx 不是 v-model:show 的有效值。预期值: v-model:show HOT 2
- [menu]: 是否只被`show`控制显示 HOT 3
- [menu] 设置了触发方式为hover,通过双向绑定控制,会出现闪烁的情况 HOT 1
- I used pnpm run dev to run, and the web page was blank, and then an error was reported. HOT 2
- LoadingBar用在vue3中路由守卫失效 HOT 8
- 发布到npm,无法使用 HOT 2
- 可否增加侧滑界面,方便将一些交互收到这里 HOT 2
- build后,from包含 space 中,动态添加input,导致数据异常 HOT 3
- toPxNum 方法不支持 dvh, svh, lvh 等 css 单位,导致 var-list 组件的 offset 无法正常工作 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from varlet.