Skip to content

Conversation

@raimund-schluessler
Copy link
Contributor

@raimund-schluessler raimund-schluessler commented Sep 27, 2022

This forwards a ref of an action to the respective inline action.

This allows to do something like this now:

<template>
	<NcActions ref="actions">
		<NcActionButton @click="actionDelete" ref="actionbutton">
			<template #icon>
				<Delete :size="20" />
			</template>
			Delete
		</NcActionButton>
	</NcActions>
</template>
<script>
import Delete from 'vue-material-design-icons/Delete'

export default {
	components: {
		Delete,
	},
	methods: {
		actionDelete() {
			alert('Delete')
			console.debug(this.$refs.actions.$refs.actionbutton) // Not defined before this PR.
		},
	},
}
</script>

However, the use case in nextcloud/server#34288 won't work anymore without adjustments, because we use a render function now, and the ref is not available in the context of the current component anymore.

Signed-off-by: Raimund Schlüßler <[email protected]>
@raimund-schluessler
Copy link
Contributor Author

/backport to stable6

@raimund-schluessler raimund-schluessler changed the title Forward attrs of actions to inline actions Forward ref of actions to inline actions Sep 30, 2022
@skjnldsv skjnldsv merged commit 40b00ea into master Oct 25, 2022
@skjnldsv skjnldsv deleted the fix/3298/actions-refs branch October 25, 2022 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ref of NcActionButton/Router/Link not forwarded to inline actions

4 participants