I have no problem passing a single data to the subcomponent, but the object is wrong
subcomponent:
<template>
<div class="nowinfo" >
<div class="nowinfo-header"></div>
<div class="nowinfo-content">
<div class="nowinfo-item now-date"><span> :</span></div>
<div class="nowinfo-item duty"><span>:</span> </div>
<div class="nowinfo-item duty-tel"><span></span> </div>
</div>
<div class="remind">:2</div>
</div>
</template>
<script>
export default {
name: "newinfo",
props:{
dutyinfo:{
type:Object,
required:true
}
},
mounted: function () {
// console.log(dutyinfo);
},
data(){
return{
duty:this.dutyinfo
};
},
methods: {
},
computed: {
}
}
</script>
parent component:
<style lang="less">
@import "./home.less";
@import "../../styles/common.less";
</style>
<template>
<div class="home-main" >
<Row :gutter="10">
<Col span="6">
<div class="now-info ">
<now-info v-bind="dutyinfo"></now-info>
</div>
</Col>
<Col span="12"></Col>
<Col span="6"></Col>
</Row>
</div>
</template>
<script>
import cityData from "./map-data/get-city-value.js";
import nowInfo from "./components/nowInfo.vue";
import attendanceCount from "./components/attendance-count.vue";
import kalendarInfo from "./components/kalendar-info.vue";
import subSchedule from "./components/subSchedule.vue";
import subWorkLog from "./components/sub-workLog.vue";
import subFileManage from "./components/sub-fileManage.vue";
import subInfoRanking from "./components/sub-infoRanking.vue";
export default {
name: "home",
components: {
"now-info":nowInfo,
"attendance-count":attendanceCount,
"kalendar-info":kalendarInfo,
"sub-schedule":subSchedule,
"sub-workLog":subWorkLog,
"sub-file-manage":subFileManage,
"sub-info-ranking":subInfoRanking
},
data () {
return {
dutyinfo:{
date:"",
dutyname:"XX",
dutyposition:"",
telNum:18246416213,
unreadMailCount:2
}
}
},
computed: {
date () {
var date=new Date();
var l = ["","","","","","",""];
var year=date.getFullYear(); //
var mon=date.getMonth()+1; //
var da=date.getDate(); //
var day=date.getDay(); //
var str = "" + l[day];
var nowDate = year + ""+mon+""+da+""+" "+" "+str;
return nowDate;
}
},
methods: {
}
};
</script>
working overtime on weekends. I have to catch up on the project. I hope all of you can give us some advice
.