xiaozuoqiang 2021-07-16 17:31 采纳率: 40%
浏览 464
已结题

vue中父组件向子组件传递值,子组件更改了值,却不能渲染到页面

父组件传递值

<Entry v-if="qureyVis && temp && Classvalue && !isqurey " :userList="userList" @UpdateUser="updateScore" @addUsers="addScore"></Entry>

子组件:

<template>
    <div class="ss">
        <el-row class="borderColor">
            <el-col :span="14" class="borderColor2">用户id</el-col>
            <el-col :span="5" class="borderColor2">姓名</el-col>
            <el-col :span="4" >课程成绩</el-col>
        </el-row>
        <el-row v-for="(item,index) in userList" :key="index" :class="item.status===200?'borderColor1 colorgreen':'borderColor1 '">
            <el-col :span="14" class="borderColor2">{{item.id}}</el-col>
            <el-col :span="5" class="borderColor2">{{item.name}}</el-col>
            <el-col :span="4" ><input type="number" v-on:change="size(item.score,index)" v-model="item.score" :min=0 :max=100 /></el-col>
        </el-row>
    </div>
</template>

export default {
    data(){
        return{
            currentPage:1,
        }
    },
    props:['userList'],
    mounted(){
    },
    methods:{
        // 对input输入的数字进行操作
        size(score,index){
            if(score>100){
                // this.userList[index].score=100
                this.$set(this.userList[index],'score',100)
            }else if(score<0 || score==''){
                // this.userList[index].score=0
                this.$set(this.userList[index],'score',0)
            }else if(score.length>1&&score[0]==0){
                // this.userList[index].score=score.substr(1);
                this.$set(this.userList[index],'score',score.substr(1))
                this.size(this.userList[index].score,index)
            }
            // console.log(this.data);
        },
   }
}

img

img

  • 写回答

3条回答 默认 最新

  • CSDN专家-Time 2021-07-16 17:37
    关注
    评论

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 8月7日
  • 创建了问题 7月16日

悬赏问题

  • ¥15 is not in the mmseg::model registry。报错,模型注册表找不到自定义模块。
  • ¥15 安装quartus II18.1时弹出此error,怎么解决?
  • ¥15 keil官网下载psn序列号在哪
  • ¥15 想用adb命令做一个通话软件,播放录音
  • ¥30 Pytorch深度学习服务器跑不通问题解决?
  • ¥15 部分客户订单定位有误的问题
  • ¥15 如何在maya程序中利用python编写领子和褶裥的模型的方法
  • ¥15 Bug traq 数据包 大概什么价
  • ¥15 在anaconda上pytorch和paddle paddle下载报错
  • ¥25 自动填写QQ腾讯文档收集表