Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.1k views
in Technique[技术] by (71.8m points)

vue初学,无法获取scope中数据

<template>
 <div class='user-table-root'>
 <!--表单添加-->
 <el-button type="success" @click="addListRow()" round>添加行信息</el-button>
 <el-table :data="datas = content.cardInfo" border height="550" class='user-table-container'>
 <el-table-column fixed="left" label="MRO客户抬头" width="120">
 <template slot-scope="scope">
 <!--<el-input v-model="scope.row.MROCardName ">-->
 <!--<i slot="suffix" @click="openCardCode('MROCardName','MROCardCode',scope.$index)" class="el-input__icon el-icon-search"></i>--> <!--</el-input>--> <div>{{scope.row.MROCardName}}</div>
 </template> </el-table-column> <el-table-column label="MRO分配金额" width="320">
 <template slot-scope="scope">
 <!-- {{ scope.row.MROAmount }}-->
 <el-input v-model="scope.row.MROAmount" type="number"></el-input>
 </template> </el-table-column> <el-table-column label="大宗客户抬头" width="320">
 <template slot-scope="scope">
 <el-input v-model="scope.row.DZCardName">
 <i slot="suffix" @click="openCardCode('DZCardName','DZCardCode',scope.$index)" class="el-input__icon el-icon-search"></i>
 </el-input> </template> </el-table-column> <el-table-column label="大宗分配额" width="320">
 <template slot-scope="scope">
 <!--   {{ scope.row.DZAmount }}-->
 <el-input v-model="scope.row.DZAmount" type="number"></el-input>
 </template> </el-table-column>
 <el-table-column label="操作" width="220">
 <template slot-scope="scope">
 <el-button size="mini" type="danger" @click="handleDelete(scope.$index)">删除</el-button>
 </template> </el-table-column> </el-table> </div></template>
 
 
 <script>
 export default {
        data () {
            return {
                // name: "taskList"
 webSocket: null,
 demo: '',
 value: '',
 package: {
                    count: 5,
 price: 5
 },
 content: {
                    cardInfo: [
                        {
                            "MROCardCode":"123",
 "MROCardName":"",
 "DZCardCode":"",
 "DZCardName":"",
 "MROAmount":'',
 "DZAmount":''
 },
 {
                            "MROCardCode":"三个人",
 "MROCardName":"",
 "DZCardCode":"",
 "DZCardName":"",
 "MROAmount":'',
 "DZAmount":''
 }
                    ]
                }
            }
        },

无法获取scope中的数据

<el-table-column fixed="left" label="MRO客户抬头" width="120">
 <template slot-scope="scope">
 <!--<el-input v-model="scope.row.MROCardName ">-->
 <!--<i slot="suffix" @click="openCardCode('MROCardName','MROCardCode',scope.$index)" class="el-input__icon el-icon-search"></i>--> <!--</el-input>--> <div>{{scope.row.MROCardName}}</div>
 </template></el-table-column>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
<el-table :data="datas = content.cardInfo" border height="550" class='user-table-container'>

赋值?

应该是

<el-table :data="content.cardInfo" border height="550" class='user-table-container'>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...