-
Notifications
You must be signed in to change notification settings - Fork 0
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
refactor(input-range): Realize two-way binding of v-model #12
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修改完成后请回复
<input :value="modelValue && modelValue[0]" @input="handleStartInput" /> | ||
<input :value="modelValue && modelValue[1]" @input="handleEndInput" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不需要判断是否有modelValue变量,直接采用后面的写法就行
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
数组为[] , 不确定 会不会直接赋值 undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
就当他是必须要传的参数就行
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[] 好像也是当做传了参数的呀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
要不直接在prop的那个验证回调里写一个验证就行
There was a problem hiding this comment.
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 } }) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handleEndInput名字错误
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修改
const userInputs = computed(() => { | ||
return modelValue | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这块想要实现什么功能
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
再想这组件内部,需不需要保存一个自己的modelvalue值
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不需要有自己的modelValue,只要不绑定变量就不能修改
实现InputRange v-model 双向绑定