Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/harmony form #10640

Merged
merged 5 commits into from
Dec 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
<div>
<input
type='submit'
if="{{formType === 'submit'}}"
@touchstart="onTouchStart"
@touchend="onTouchEnd"
>{{value}}</input>
<input
type='reset'
elif="{{formType === 'reset'}}"
@touchstart="onTouchStart"
@touchend="onTouchEnd"
>{{value}}</input>
<button
else
id="{{id}}"
class="{{cls}} {{clsType}} {{clsSize}} {{clsPlain}} {{clsDisable}} {{clsDisableType}} {{clsLoading}} {{clsHover}}"
type="{{harmonyType}}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export default createOption({
hoverClass: {
default: 'button-hover'
},
formType: {
default: null
},
cn: {
default: []
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<div>
<input
id="{{id}}"
name="{{name}}"
type="checkbox"
checked="{{checked}}"
disabled="{{disabled}}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export default {
props: [
'id',
'value',
'name',
'disabled',
'checked',
'groupId',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<div>
<form
id="{{id}}"
class="{{cls}}"
@submit="onSubmit"
@reset="onReset"
>
<slot></slot>
</form>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { createOption } from '../utils'

export default createOption({
props: ['cls', 'id'],
onSubmit (e) {
this.$trigger('submit', { value: e.value })
},
onReset () {
this.$trigger('reset')
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<input
id="{{ id }}"
value="{{ value }}"
name="{{ name }}"
type="{{ realType }}"
placeholder="{{ placeholder }}"
style="placeholder-color: {{placeholderColor}};"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default createOption({
id: String,
value: String,
type: String,
name: String,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要为其余表单组件也补上 name 属性

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

只有input 才支持 name属性,其余没有这个属性

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

radio、checkbox 加一下,其余的表单组件我和鸿蒙侧对一下

password: Boolean,
placeholder: String,
placeholderColor: '#99000000',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
id="{{ id }}"
value="{{ value }}"
type="radio"
name="{{ groupId }}"
name="{{ name }}"
disabled="{{disabled}}"
checked="{{ checked }}"
@change="onChange"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export default {
props: [
'id',
'name',
'groupId',
'value',
'checked',
Expand Down