The el-option of el-select in vue el-element selects the value, but the value is not displayed in the page box. You need to enter another box value to display it. The same is true for input

Description of the problem: The el-option of el-select in el-element selects the value, but the value is not displayed in the page box. You need to enter another box value to display it. Or solve the problem that the input cannot enter a value.

/在el-select中写一个事件 @change="change"
			<el-form-item  prop="aa">
				<el-select
					v-model="dataForm.aa"
					@change="change" //加上这个函数
				>
					<el-option
						v-for="(item, index) in belongToCountryList"
						:key="index"
						:label="item.text"
						:value="item.code"
					></el-option>
				</el-select>
			</el-form-item>

~~~~~~~~~~
                  change(){
	                 this.$forceUpdate() //其作用就是强制性刷新了一次
                    }

 The reason for the problem:
the data in the drop-down box calls the interface cyclically, there are too many layers of data, the render function is not automatically updated, and it needs to be manually refreshed

Problem solving ideas:
The forceUpdate() method is also applicable to some deep component state. When the state has changed, it can be called on the component to solve the problem that the page value does not change after the item attribute value is modified in the page v-for. 

Guess you like

Origin blog.csdn.net/Humor_L/article/details/125423183