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
4.1k views
in Technique[技术] by (71.8m points)

vue组件传值问题

父传子,之前的组件都是这样写的没报错,现在这个组件报错,我已经指定了type哈报错,然后写成这样props:['titleStr']也不行
image.png
`<template>
<view class="back_header">

    <icon @click="toBack"></icon>
    <text>{{titleStr}}</text>

</view>
</template>

<script>
export default {
name: "backHeader",

props: {
    titleStr: String
},

data () {

return {
}

},
methods: {

toBack() {
        this.$mRouter.back();
}

}
}
</script>`
父:
<back-header :titleStr="titleStr" :backHeadShow="backHeadShow" v-if="backHeadShow"></back-header>


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

1 Answer

0 votes
by (71.8m points)

BackHeader组件需要一个必填props type
<BackHeader type="xxx" />


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

...