How does vue use v-model to bind the value of a parent component within a child component?

parent component

Mar.02,2021

<template>
  <el-select v-model="selectValueOrg" @change="queryGameApi">
    <el-option
      v-for="item in baseDataList"
      :key="item.value"
      :label="lang=='zh' ? item.nameCn : item.nameEn"
      :value="item.value">
    </el-option>
  </el-select>
</template>

<script>
  export default {
    name: 'options',
    data(){
        return {selectValueOrg:this.selectValue}
    },
    props: ['selectValue', 'baseDataList'],
    methods: {
      queryGameApi() {
        this.$emit('update:selectValue', this.selectValueOrg)
        this.$emit('change')
      }
    },
    computed: {
      lang() {
        return this.$store.getters.lang
      }
    }
  }
</script>

if you write it this way, you shouldn't get it wrong

The props of the

child component has stated that selectValue is a prop, but in fact the parent component does not pass this value to the child component

Menu