Comments (4)
这个可能是用法问题,ValuesChange不要多次绑定,可发下js
from ant-design-mini.
import {
Form
} from 'antd-mini-v1/es/Form/form';
Page({
data: {
position: 'horizontal',
},
form: new Form(),
onReady() {
this.form.onValuesChange((changedValues, allValues) => {
console.log(changedValues);
});
},
handleRef(ref) {
this.form.addItem(ref);
},
reset() {
this.form.reset();
},
toggle() {
this.setData({
position: this.data.position === 'horizontal' ? 'vertical' : 'horizontal',
});
},
async submit() {
const values = await this.form.submit();
my.alert({
title: '提交',
content: JSON.stringify(values),
});
}
});
我会反复操作:跳转这个界面,返回,再跳转,就是导致多次绑定了,那我该怎么绑定呢
from ant-design-mini.
这个应该是钉钉小程序中的问题:页面跳转了,但是小程序页面还没有被unLoad,再次进入页面,调用了onReady。
你可以尝试这样解决:
import { Form } from 'antd-mini-v1/es/Form/form';
Page({
data: {
position: 'horizontal',
},
onShow() {
this.form = new Form();
this.form.onValuesChange((changedValues, allValues) => {
console.log(changedValues);
});
},
handleRef(ref) {
this.form.addItem(ref);
},
reset() {
this.form.reset();
},
toggle() {
this.setData({
position: this.data.position === 'horizontal' ? 'vertical' : 'horizontal',
});
},
async submit() {
const values = await this.form.submit();
my.alert({
title: '提交',
content: JSON.stringify(values),
});
}
});
from ant-design-mini.
可以了,谢谢
from ant-design-mini.
Related Issues (20)
- 选择器能否增加搜索功能当选择项太多的时候不好选 HOT 2
- form-picker 赋值无效 HOT 2
- 手机端适配问题
- from表单的监听方法onValueChange赋值问题
- 纵向的tabs的scroll-view容器可以支持透传scroll-top、scroll-into-view等属性吗 HOT 3
- swipe-action滑动组件 HOT 1
- Popup组件目前只支持上下左右弹出,希望可以可以支持从中间弹出 HOT 1
- 日历组件需求征集 HOT 1
- form表单input框样式问题 HOT 1
- 希望avatar组件增加Icon和及字符类型
- 希望兼容一下微信小程序,虽然有点过分,但是这个需求很迫切呀 HOT 3
- antd-mini在小程序插件内报错:【插件公开组件的 acss 文件不支持使用 "元素选择器"】 HOT 2
- form-textarea HOT 1
- anti-mini组件 可供输入的下拉框 HOT 1
- 使用new form时 报错需要使用 component2 HOT 2
- 钉钉小程序 通过 dd.navigateTo跳转页面第二次报错,请问怎么解决呢 HOT 14
- input 的 type 设置 number 无效 HOT 3
- textarea 使用 onConfirm后无法清空输入的内容 HOT 4
- 如何在 input 设置了 disabled=true 时,修改 input 的字体样式 ? HOT 2
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 ant-design-mini.