The introduction

I was given a new bug that I had postponed, the one described in the title. The DatePicker component of iView will shrink abnormally when selecting a year or month. Normal should not shrink, because after the choice of months to choose, after the choice of months to choose days. Referring to the iView demo, I found there was no problem with the usage. The first thought was that the current project had global configuration of iView or some plug-in function conflicts (the project was written by my former colleague, I didn’t know what the global configuration was). Finally, I found that it was affected by global configuration, and it was a bug of iView. Here’s a diagram to illustrate it.

Bug Details

The bug is obvious in the driven graph.

Cause of bug

Capture =”false” this capture is a new global configuration property added to iView 4.x

The default value is true, so there is no problem with the official Demo, but the global configuration of the iView is configured in the project (usually in main.js)

Vue.use(iView, {
	capture: false
})
Copy the code

This is an iView bug. The solution is to remove it globally (since the default is true) or add capture=”false” to every DatePicker use.

<DatePicker type="date" :capture="trie" placeholder="Select date" style="width: 200px"></DatePicker>
Copy the code

The DatePicker source code is such that the outermost tag adds these attributes, although other dropdowns are also used, but I have not detected the problem (see if you are interested).

<div
	v-click-outside:[capture].mousedown="handleClose"
	v-click-outside:[capture].touchstart="handleClose"
	v-click-outside:[capture]="handleClose">
</div>
Copy the code

The DatePicker props was added

 / / 4.0.0
 capture: {
     type: Boolean.default () {
         return !this.$IVIEW ? true : this.$IVIEW.capture; }}Copy the code

conclusion

Well above so much, friends in the use of plug-ins can not locate the problem, you can go to see the source code, in fact, the source code is not complex, as you write your own code. To solve the bug is to understand the problem. When I am free, I will mention issuse on iView. Today’s work record will be shared here. Hey hey