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

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb0c21-480d3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb0c21-480d3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?