Skip to content

Commit 7c9828e

Browse files
committed
update: forms 示例
update: forms 1.0.44 to ext update: data-checkbox 0.1.7 to ext
1 parent 7f0cb27 commit 7c9828e

File tree

8 files changed

+20
-17
lines changed

8 files changed

+20
-17
lines changed

index.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,12 @@ componentsPackageJsons.forEach(item => {
3131

3232
let uniuiPackage = path.join(modulesPath, 'uni-ui', 'package.json')
3333
uniuiPackage = JSON.parse(fs.readFileSync(uniuiPackage).toString())
34-
console.log(uniuiPackage.version);
3534
const uniuiChangelog = updateChangelogFile(
3635
path.join(modulesPath, 'uni-ui', 'changelog.md'),
3736
uniuiPackage.id,
3837
uniuimd
3938
)
4039

41-
console.log(uniuiChangelog)
42-
4340
// // 将最新的个组件写入缓存区域
4441
// fs.writeFileSync(path.join(__dirname,'temps','sync-version.json'),JSON.stringify(syncVersion,null,2))
4542
// ------ 写入最新的缓存版本号 end------

pages/nvue/forms/forms.nvue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ export default {
179179
// this.formData 应该包含所有需要校验的表单
180180
// 模拟异步请求数据
181181
setTimeout(() => {
182-
this.formData = {
182+
this.formData = {
183+
id:'testId',
183184
name: 'DCloud',
184185
age: 21,
185186
email: '',
@@ -210,9 +211,8 @@ export default {
210211
* @param {Object} form
211212
*/
212213
submitForm(form) {
213-
// console.log(this.formData);
214214
this.$refs[form]
215-
.submit()
215+
.validate(['id','remarks'])
216216
.then(res => {
217217
console.log('表单的值:', res)
218218
uni.showToast({

pages/vue/forms/forms.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ export default {
179179
// this.formData 应该包含所有需要校验的表单
180180
// 模拟异步请求数据
181181
setTimeout(() => {
182-
this.formData = {
182+
this.formData = {
183+
id:'testId',
183184
name: 'DCloud',
184185
age: 21,
185186
email: '',
@@ -210,9 +211,8 @@ export default {
210211
* @param {Object} form
211212
*/
212213
submitForm(form) {
213-
// console.log(this.formData);
214214
this.$refs[form]
215-
.submit()
215+
.validate(['id','remarks'])
216216
.then(res => {
217217
console.log('表单的值:', res)
218218
uni.showToast({

uni_modules/uni-data-checkbox/changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 0.1.7
1+
## 0.1.7(2021-06-02)
22
- 新增 map 属性,可以方便映射text/value属性
33
## 0.1.6(2021-05-26)
44
- 修复 不关联服务空间的情况下组件报错的Bug

uni_modules/uni-data-checkbox/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "uni-data-checkbox",
33
"displayName": "uni-data-checkbox 数据选择器",
4-
"version": "0.1.6",
4+
"version": "0.1.7",
55
"description": "通过数据驱动的单选框和复选框",
66
"keywords": [
77
"uni-ui",

uni_modules/uni-forms/changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 1.0.44
1+
## 1.0.44(2021-06-02)
22
- 新增 uni-forms-item 可以设置单独的 rules
33
- 新增 validate 事件增加 keepitem 参数,可以选择那些字段不过滤
44
- 优化 submit 事件重命名为 validate

uni_modules/uni-forms/components/uni-forms/uni-forms.vue

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,14 @@ export default {
227227
* 校验所有或者部分表单
228228
*/
229229
async validateAll(invalidFields, type, keepitem, callback) {
230-
const childrens = this.childrens;
230+
// const childrens = this.childrens;
231+
let childrens = []
232+
for(let i in invalidFields){
233+
const item = this.childrens.find(v=>v.name === i)
234+
if(item) {
235+
childrens.push(item)
236+
}
237+
}
231238
// childrens.forEach(item => {
232239
// item.errMsg = '';
233240
// });
@@ -306,7 +313,6 @@ export default {
306313
* 对整个表单进行校验的方法,参数为一个回调函数。
307314
*/
308315
submit(keepitem, callback, type) {
309-
console.log(this.modelValue);
310316
for (let i in this.modelValue) {
311317
const itemData = this.childrens.find(v => v.name === i);
312318
if (itemData) {
@@ -344,8 +350,8 @@ export default {
344350
[item.name]: this.formData[item.name]
345351
});
346352
}
347-
});
348-
return this.validateAll(invalidFields, '', callback);
353+
});
354+
return this.validateAll(invalidFields,'submit', [], callback);
349355
},
350356
351357
/**

uni_modules/uni-forms/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "uni-forms",
33
"displayName": "uni-forms 表单",
4-
"version": "1.0.43",
4+
"version": "1.0.44",
55
"description": "由输入框、选择器、单选框、多选框等控件组成,用以收集、校验、提交数据",
66
"keywords": [
77
"uni-ui",

0 commit comments

Comments
 (0)