fix: slider v-model not work

pull/2682/head
tanjinzhou 2020-07-30 16:51:14 +08:00
parent 0c32d1679d
commit d58a0f21df
4 changed files with 15 additions and 18 deletions

@ -1 +1 @@
Subproject commit 3d603c83c0d128769b81ffe12ef9d8cbd5dbb166 Subproject commit 2d8d146c97bb030ac9fe572741483db8f7436460

View File

@ -3,24 +3,12 @@
exports[`Grid renders wrapped Col correctly 1`] = ` exports[`Grid renders wrapped Col correctly 1`] = `
<div class="ant-row" style="margin-left: -10px; margin-right: -10px;"> <div class="ant-row" style="margin-left: -10px; margin-right: -10px;">
<div> <div>
<div class="ant-col ant-col-12" style="padding-left: 10px; padding-right: 10px;"> <div class="ant-col ant-col-12" style="padding-left: 10px; padding-right: 10px;"></div>
<!---->
</div>
</div>
<div class="ant-col ant-col-12" style="padding-left: 10px; padding-right: 10px;">
<!---->
</div> </div>
<div class="ant-col ant-col-12" style="padding-left: 10px; padding-right: 10px;"></div>
</div> </div>
`; `;
exports[`Grid should render Col 1`] = ` exports[`Grid should render Col 1`] = `<div class="ant-col ant-col-2"></div>`;
<div class="ant-col ant-col-2">
<!---->
</div>
`;
exports[`Grid should render Row 1`] = ` exports[`Grid should render Row 1`] = `<div class="ant-row"></div>`;
<div class="ant-row">
<!---->
</div>
`;

View File

@ -29,6 +29,9 @@ export const SliderProps = () => ({
tooltipVisible: PropTypes.bool, tooltipVisible: PropTypes.bool,
tooltipPlacement: tooltipProps.placement, tooltipPlacement: tooltipProps.placement,
getTooltipPopupContainer: PropTypes.func, getTooltipPopupContainer: PropTypes.func,
onChange: PropTypes.func,
'onUpdate:value': PropTypes.func,
onAfterChange: PropTypes.func,
}); });
const defaultTipFormatter = value => value.toString(); const defaultTipFormatter = value => value.toString();
@ -104,6 +107,10 @@ const Slider = {
blur() { blur() {
this.vcSlider.blur(); this.vcSlider.blur();
}, },
handleChange(val) {
this.$emit('update:value', val);
this.$emit('change', val);
},
}, },
render() { render() {
const { const {
@ -122,6 +129,7 @@ const Slider = {
tooltipPrefixCls, tooltipPrefixCls,
handle: info => this.handleWithTooltip(tooltipPrefixCls, prefixCls, info), handle: info => this.handleWithTooltip(tooltipPrefixCls, prefixCls, info),
ref: this.saveSlider, ref: this.saveSlider,
onChange: this.handleChange,
}; };
return <VcRange {...vcRangeProps} />; return <VcRange {...vcRangeProps} />;
} }
@ -131,6 +139,7 @@ const Slider = {
tooltipPrefixCls, tooltipPrefixCls,
handle: info => this.handleWithTooltip(tooltipPrefixCls, prefixCls, info), handle: info => this.handleWithTooltip(tooltipPrefixCls, prefixCls, info),
ref: this.saveSlider, ref: this.saveSlider,
onChange: this.handleChange,
}; };
return <VcSlider {...vcSliderProps} />; return <VcSlider {...vcSliderProps} />;
}, },

View File

@ -4,7 +4,7 @@
</div> </div>
</template> </template>
<script> <script>
import demo from '../antdv-demo/docs/empty/demo/index'; import demo from '../antdv-demo/docs/grid/demo/index';
export default { export default {
components: { components: {