Skip to content

Commit 1936147

Browse files
committed
update: 修复脚本上传示例不完整的问题
1 parent 91373ef commit 1936147

File tree

7 files changed

+74
-80
lines changed

7 files changed

+74
-80
lines changed

docs/components/icons.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ url : pages/vue/icons/icons
2626
## 图标示例
2727

2828
点击复制图标类型
29+
2930
<icons-layouts></icons-layouts>
3031

3132
## API

pages/vue/test/test.vue

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<template>
22
<view>
33
<text class="example-info">uni-forms 组件一般由输入框、选择器、单选框、多选框等控件组成,用以收集、校验、提交数据。</text>
4+
45
<uni-forms :rules="rules" :value="formData" ref="form" validate-trigger="bind" err-show-type="undertext">
56
<uni-group title="基本信息" top="0">
67
<uni-forms-item name="name" required label="用户名">
@@ -10,9 +11,6 @@
1011
<uni-forms-item name="age" required label="年龄">
1112
<input type="text" v-model="formData.age" class="uni-input-border" @blur="binddata('age', $event.detail.value)" placeholder="请输入年龄" />
1213
</uni-forms-item>
13-
<uni-forms-item name="weight" label="体重">
14-
<slider min="0" max="200" step="5" show-value v-model="formData.weight" @change="binddata('weight', $event.detail.value)"></slider>
15-
</uni-forms-item>
1614
<uni-forms-item name="email" label="邮箱"><uni-easyinput type="text" v-model="formData.email" placeholder="请输入邮箱"></uni-easyinput></uni-forms-item>
1715
<!-- #ifndef APP-NVUE -->
1816
<uni-forms-item required name="birth" label="出生日期"><uni-datetime-picker type="date" v-model="formData.birth" start="2000-06-01 06:30:30" end="2030-6-1" return-type="timestamp"></uni-datetime-picker></uni-forms-item>
@@ -65,7 +63,6 @@ export default {
6563
remarks: '',
6664
checked: false,
6765
country: -1,
68-
weight: 0,
6966
birth: ''
7067
},
7168
sex: [
@@ -129,19 +126,6 @@ export default {
129126
}
130127
]
131128
},
132-
weight: {
133-
rules: [
134-
{
135-
format: 'number',
136-
errorMessage: '体重必须是数字'
137-
},
138-
{
139-
minimum: 100,
140-
maximum: 200,
141-
errorMessage: '体重应该大于 {minimum} 斤,小于 {maximum} 斤'
142-
}
143-
]
144-
},
145129
birth: {
146130
rules: [
147131
{
@@ -204,7 +188,6 @@ export default {
204188
remarks: '热爱学习,热爱生活',
205189
checked: false,
206190
country: 2,
207-
weight: 120,
208191
birth: ''
209192
}
210193
uni.hideLoading()

plugin/upload.js

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const fs = require('fs')
55
const util = require('../build/util.js')
66
const buildReadme = require('../build/build-readme.js')
77
const root = path.join(__dirname,'..')
8-
// const modulesId = 'uni-test'
9-
const modulesId = process.env.UNI_MODULES_ID
8+
const modulesId = process.env.UNI_MODULES_ID
9+
// const modulesId = 'uni-icons'
1010
const comName = modulesId.replace(/uni-/, '')
1111
const comPath = path.join(root, 'uni_modules')
1212
// console.error('upload.js - modulesId :' + modulesId);
@@ -19,7 +19,7 @@ const readmePath = path.join(root, 'docs', 'components', comName + '.md')
1919

2020
const mdExists = fs.existsSync(readmePath)
2121
if (mdExists) {
22-
const content = handleReadme(readmePath)
22+
const content = handleReadme(readmePath,comName)
2323
util.write(path.join(root, 'uni_modules', modulesId, 'readme.md'), content)
2424
}
2525

@@ -45,23 +45,24 @@ if (modulesId === 'uni-ui') {
4545
// 将组件拷贝到临时目录
4646
util.copyDir(getModulesPath(modulesId), path.join(tempExamplePath, 'uni_modules', modulesId))
4747
handlePageJson(comName, tempExamplePath)
48-
4948
// 获取关联组件
5049
if (packageJson && packageJson.uni_modules && packageJson.uni_modules.dependencies.length > 0) {
5150
relationComponents = packageJson.uni_modules.dependencies
52-
}
53-
51+
}
5452
// 同步依赖组件
55-
if (relationComponents && relationComponents.length > 0) {
53+
if (relationComponents && relationComponents.length > 0) {
5654
relationComponents.reduce((promise, item) => {
57-
return new Promise((resolve, reject) => {
58-
util.copyDir(getModulesPath(item), path.join(tempExamplePath, 'uni_modules', item))
55+
return new Promise((resolve, reject) => {
56+
util.copyDir(getModulesPath(item), path.join(tempExamplePath, 'uni_modules', item))
57+
resolve()
5958
})
60-
}, Promise.resolve([])).then(res => {
59+
}, Promise.resolve([])).then(res => {
6160
// console.error('所有依赖组件同步完成');
6261
setPageComponents(modulesId, comName)
62+
}).catch((err)=>{
63+
console.log('error',err);
6364
})
64-
} else {
65+
} else {
6566
setPageComponents(modulesId, comName)
6667
}
6768
}
@@ -167,17 +168,21 @@ function getModulesPath(name) {
167168
* 处理 readme.md
168169
* @param {Object} readmePath
169170
*/
170-
function handleReadme(readmePath) {
171+
function handleReadme(readmePath,comName) {
171172
let content = util.read(readmePath)
172173
// 兼容 windows ,将 \r\n 全部替换成 \n
173174
content = content.replace(/\r\n/ig, '\n')
174175
// 删除头部额外信息,在其他平台不支持,只在 uni ui 中支持
175-
content = content.replace(/---([\s\S]*?)---/ig, '')
176+
content = content.replace(/---([\s\S]*?)---/ig, '').replace(/## ([\s\S]*?)\<\/icons-layouts\>/ig, '')
177+
176178
// 转换 ::: 语法
177179
content = content.replace(/::: (.*?)\n([\s\S]*?):::/ig, function(_, $1, $2) {
178180
$1 = $1.replace(/(tip|danger|warning)+ /,'')
179181
return '> **'+ $1 +'**\n'+ $2.split('\n').filter(item => item !== '').map(item => `> ${item}\n`).join('')
180182
})
183+
184+
content += `\n\n## 组件示例\n\n点击查看:[https://hellouniapp.dcloud.net.cn/pages/extUI/${comName}/${comName}](https://hellouniapp.dcloud.net.cn/pages/extUI/${comName}/${comName})`
185+
181186
return content
182187
}
183188

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

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,26 @@
2222

2323
<script>
2424
/**
25-
* Field 输入框
25+
* FormsItem 表单子组件
2626
* @description 此组件可以实现表单的输入与校验,包括 "text" 和 "textarea" 类型。
27-
* @tutorial https://ext.dcloud.net.cn/plugin?id=21001
28-
* @property {Boolean} required 是否必填,左边显示红色"*"号(默认false)
29-
* @property {String} validateTrigger = [bind|submit] 校验触发器方式 默认 submit 可选
30-
* @value bind 发生变化时触发
31-
* @value submit 提交时触发
32-
* @property {String } leftIcon label左边的图标,限 uni-ui 的图标名称
33-
* @property {String } iconColor 左边通过icon配置的图标的颜色(默认#606266)
34-
* @property {String } label 输入框左边的文字提示
35-
* @property {Number } labelWidth label的宽度,单位px(默认65)
36-
* @property {String } labelAlign = [left|center|right] label的文字对齐方式(默认left)
37-
* @value left label 左侧显示
38-
* @value center label 居中
39-
* @value right label 右侧对齐
40-
* @property {String } labelPosition = [top|left] label的文字的位置(默认left)
41-
* @value top 顶部显示 label
42-
* @value left 左侧显示 label
43-
* @property {String } errorMessage 显示的错误提示内容,如果为空字符串或者false,则不显示错误信息
44-
* @property {String } name 表单域的属性名,在使用校验规则时必填
27+
* @tutorial https://ext.dcloud.net.cn/plugin?id=2773
28+
* @property {String} name 表单域的属性名,在使用校验规则时必填
29+
* @property {Boolean} required 左边显示红色"*"号,样式显示不会对校验规则产生效果(默认 false)
30+
* @property {String} validate-trigger = [bind|submit] 表单校验时机(默认 submit)
31+
* @value bind 数据发生变化时触发
32+
* @value submit 提交表单是触发
33+
* @property {String} left-icon label左边的图标,限uni-ui的图标名称
34+
* @property {String} icon-color 左边通过icon配置的图标的颜色 (默认 #606266)
35+
* @property {String} label 输入框左边的文字提示
36+
* @property {Number} label-width label的宽度,单位px
37+
* @property {String} label-align = [left|center|right] label的文字对齐方式(默认 left)
38+
* @value left 左对齐
39+
* @value center 居中对齐
40+
* @value right 右对齐
41+
* @property {String} label-position = [top|left] label的文字的位置(默认 left)
42+
* @value top 顶部显示 label
43+
* @value left 左侧显示 label
44+
* @property {String} error-message 显示的错误提示内容,如果为空字符串或者false,则不显示错误信息
4545
*/
4646
4747

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

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,8 @@
88
</template>
99

1010
<script>
11-
/**
12-
* Forms 表单
13-
* @description 由输入框、选择器、单选框、多选框等控件组成,用以收集、校验、提交数据
14-
* @tutorial https://ext.dcloud.net.cn/plugin?id=2773
15-
* @property {Object} rules 表单校验规则
16-
* @property {String} validateTrigger = [bind|submit] 校验触发器方式 默认 submit 可选
17-
* @value bind 发生变化时触发
18-
* @value submit 提交时触发
19-
* @property {String} labelPosition = [top|left] label 位置 默认 left 可选
20-
* @value top 顶部显示 label
21-
* @value left 左侧显示 label
22-
* @property {String} labelWidth label 宽度,默认 65px
23-
* @property {String} labelAlign = [left|center|right] label 居中方式 默认 left 可选
24-
* @value left label 左侧显示
25-
* @value center label 居中
26-
* @value right label 右侧对齐
27-
* @property {String} errShowType = [undertext|toast|modal] 校验错误信息提示方式
28-
* @value undertext 错误信息在底部显示
29-
* @value toast 错误信息toast显示
30-
* @value modal 错误信息modal显示
31-
* @event {Function} submit 提交时触发
32-
*/
3311
import Vue from 'vue'
12+
import Validator from './validate.js'
3413
Vue.prototype.binddata = function(name, value, formName) {
3514
if (formName) {
3615
this.$refs[formName].setValue(name, value)
@@ -48,8 +27,29 @@
4827
}
4928
}
5029
51-
import Validator from './validate.js'
52-
30+
/**
31+
* Forms 表单
32+
* @description 由输入框、选择器、单选框、多选框等控件组成,用以收集、校验、提交数据
33+
* @tutorial https://ext.dcloud.net.cn/plugin?id=2773
34+
* @property {Object} rules 表单校验规则
35+
* @property {String} validateTrigger = [bind|submit] 校验触发器方式 默认 submit 可选
36+
* @value bind 发生变化时触发
37+
* @value submit 提交时触发
38+
* @property {String} labelPosition = [top|left] label 位置 默认 left 可选
39+
* @value top 顶部显示 label
40+
* @value left 左侧显示 label
41+
* @property {String} labelWidth label 宽度,默认 65px
42+
* @property {String} labelAlign = [left|center|right] label 居中方式 默认 left 可选
43+
* @value left label 左侧显示
44+
* @value center label 居中
45+
* @value right label 右侧对齐
46+
* @property {String} errShowType = [undertext|toast|modal] 校验错误信息提示方式
47+
* @value undertext 错误信息在底部显示
48+
* @value toast 错误信息toast显示
49+
* @value modal 错误信息modal显示
50+
* @event {Function} submit 提交时触发
51+
*/
52+
5353
export default {
5454
name: 'uniForms',
5555
props: {
@@ -126,7 +126,7 @@
126126
this.formTrigger = this.trigger
127127
this.formRules = formRules
128128
// if (!this.validator) {
129-
this.validator = new Validator(formRules)
129+
this.validator = new Validator(formRules)
130130
// }
131131
} else {
132132
return
@@ -286,7 +286,8 @@
286286
// 获取当前未通过子组件实例
287287
example = this.childrens.find(child => child.name === resultData.key)
288288
// 获取easyInput 组件实例
289-
const inputComp = this.inputChildrens.find(child => child.rename === (example && example.name))
289+
const inputComp = this.inputChildrens.find(child => child.rename === (example && example
290+
.name))
290291
if (inputComp) {
291292
inputComp.errMsg = resultData.errorMessage
292293
}

uni_modules/uni-icons/readme.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@
2121
<uni-icons type="contact" size="30"></uni-icons>
2222
```
2323

24-
## 图标示例
2524

26-
点击复制图标类型
27-
<icons-layouts></icons-layouts>
2825

2926
## API
3027

@@ -42,3 +39,8 @@
4239
|:-: |:-: |:-: |
4340
|@click|点击 Icon 触发事件|- |
4441

42+
43+
44+
## 组件示例
45+
46+
点击查看:[https://hellouniapp.dcloud.net.cn/pages/extUI/icons/icons](https://hellouniapp.dcloud.net.cn/pages/extUI/icons/icons)

uni_modules/uni-test/readme.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11

22

33
## DataCheckbox 数据驱动的单选复选框
4-
> 代码块: `uDataCheckbox`
4+
> **组件名:uni-data-checkbox**
5+
> 代码块: `uDataCheckbox`123
56
67

78
本组件是基于uni-app基础组件checkbox的封装。本组件要解决问题包括:
@@ -13,6 +14,7 @@
1314

1415
在uniCloud开发中,`DB Schema`中配置了enum枚举等类型后,在web控制台的[自动生成表单](https://uniapp.dcloud.io/uniCloud/schema?id=autocode)功能中,会自动生成``uni-data-checkbox``组件并绑定好data
1516

17+
> **注意事项**
1618
> 为了避免错误使用,给大家带来不好的开发体验,请在使用组件前仔细阅读下面的注意事项,可以帮你避免一些错误。
1719
> - 组件需要依赖 `sass` 插件 ,请自行手动安装
1820
> - 本组件为数据驱动,目的是快速投入使用,只可通过 style 覆盖有限样式,不支持自定义更多样式

0 commit comments

Comments
 (0)