// 1、设置场景值 scene: '', // 2、标题上使用动态title :title="{ add: '新增题目', edit: '编辑题目' }[scene]" // 3、父级组件使用子级组件 <Add ref="add" /> // 4、编辑和新增按钮分别使用子级场景值 this.$refs.add.scene = 'add' this.$refs.add.scene = 'edit'