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

refactor(input-range): Realize two-way binding of v-model #12

Merged
merged 2 commits into from
Mar 15, 2021

Conversation

zqy1151215064
Copy link

实现InputRange v-model 双向绑定

@Lydanne
Copy link

Lydanne commented Mar 13, 2021

hug-sun#579

Copy link

@Lydanne Lydanne left a comment

Choose a reason for hiding this comment

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

修改完成后请回复

Comment on lines 3 to 4
<input :value="modelValue && modelValue[0]" @input="handleStartInput" />
<input :value="modelValue && modelValue[1]" @input="handleEndInput" />
Copy link

Choose a reason for hiding this comment

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

这里不需要判断是否有modelValue变量,直接采用后面的写法就行

Copy link
Author

Choose a reason for hiding this comment

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

数组为[] , 不确定 会不会直接赋值 undefined

Copy link

Choose a reason for hiding this comment

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

就当他是必须要传的参数就行

Copy link
Author

Choose a reason for hiding this comment

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

[] 好像也是当做传了参数的呀

Copy link

Choose a reason for hiding this comment

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

要不直接在prop的那个验证回调里写一个验证就行

Copy link

Choose a reason for hiding this comment

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

或者不写也行就当,我们传人的就是你想的,文档写清楚就行

emit('update:modelValue', [event.target.value, modelValue[1]])
}

const handleEntInput = function (event: { target: { value: any } }) {
Copy link

Choose a reason for hiding this comment

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

handleEndInput名字错误

Copy link
Author

Choose a reason for hiding this comment

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

已修改

Comment on lines 26 to 28
const userInputs = computed(() => {
return modelValue
})
Copy link

Choose a reason for hiding this comment

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

这块想要实现什么功能

Copy link
Author

Choose a reason for hiding this comment

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

再想这组件内部,需不需要保存一个自己的modelvalue值

Copy link

Choose a reason for hiding this comment

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

不需要有自己的modelValue,只要不绑定变量就不能修改

@Lydanne Lydanne merged commit 3a03f6d into refactor/datetimepicker Mar 15, 2021
@Lydanne Lydanne linked an issue Mar 15, 2021 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor DateTimePicker Component (hug-sun#579)
2 participants