父组件
<template>
<div>
<buttonLink :title.sync='title'>提交</buttonLink>
</div>
</template>
import buttonLink from '@/components/button'
export default {
components:{ buttonLink },
data() {
return {
title:'123'
};
}
};
子组件
<template>
<div>
<el-button type='primary' @click='change'>
<slot>submit</slot>
</el-button>
</div>
</template>
export default {
props:{
title:{
type:String
}
},
data() {
return {};
},
methods: {
change(){
this.$emit('update:title','456')
}
}
};
</script>