Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Problems with Ref on CCard#202

Unanswered
aviatmcel asked this question inQ&A
Discussion options

Hi,

I am using CoreUI v4 for VueJS, and while using CCard, it seems like CCard doesn't expose any refs when I try to access it via Vue devtools.

I created an example – one with a simple div, and other with the CCard:

<script setup lang="ts">import { CCard, CButton } from '@coreui/vue-pro';import { onMounted, ref } from 'vue';const count = ref(0);const cardRef = ref(null);const customCardRef = ref(null);onMounted(() => { console.log({ cardRef: cardRef.value, customCardRef: customCardRef.value });});</script><template> <CCard ref="cardRef">    <h1>CoreUI CCard</h1>    <div>The count is: {{ count }}</div>    <CButton color="primary" @click="count++">Increment Counter</CButton> </CCard> <div ref="customCardRef">    <h1>Custom Card</h1>    <div>The count is: {{ count }}</div>    <CButton color="primary" @click="count++">Increment Counter</CButton> </div></template><style scoped>a { color: #42b983;}label { margin: 0 0.5em; font-weight: bold;}code { background-color: #eee; padding: 2px 4px; border-radius: 4px; color: #304455;}.custom-card,.border-style { border: 2px solid lightgrey;}</style>

This is how it looks like:

image

These are the refs that each card returns:

  1. Ref from the CCard:

image

  1. Ref from the custom div:

image

Basically the question is: How do I access the inner ref of the CCard component? Thanks!

You must be logged in to vote

Replies: 0 comments

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
1 participant
@aviatmcel

[8]ページ先頭

©2009-2025 Movatter.jp