You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this is my component and i can't get element value when my component tag is router-link, any idea?
i also put my project link to help me.
<script setup lang="ts">
/**
* for compile icons we use PrIcon components, and
* it will create the span tag and put icon svg into it
* but when there is no default slots icons must compile directly into self link
* with no span tag, so in future we must remove addition span tag
* when there is no default slots defined
*/
import {computed, onMounted, ref, useSlots, watchEffect} from "vue";
import { buttonClassObject } from "@bs/scripts/util/classes";
import PrIcon from "@bc/core/icon.vue";
import {icon, IconElement} from "../../src/scripts/util/util";
// must remove with future release of vue and must use as
// import { ButtonPropsType } from "@bs/scripts/util/props";
interface ButtonPropsType {
tag?: 'router-link' | 'a',
to?: string,
href?: string,
default?: boolean,
primary?: boolean,
secondary?: boolean,
muted?: boolean,
xSmall?: boolean,
rounded?: boolean,
circle?: boolean,
collapse?: boolean,
icon?: string,
ratio?: number,
}
const props = withDefaults(defineProps(), {
tag: 'router-link'
})
// define button classes from defined props
const buttonClass = computed(() => buttonClassObject(props))
const slots = useSlots()
const el = ref(null)
function setIcon() {
icon(el.value, props.icon, props.ratio)
}
onMounted(() => {
watchEffect(setIcon)
})
</script>
This discussion was converted from issue #1639 on December 21, 2022 12:59.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Version
4.1.6
Reproduction link
github.com/prfardin/efa-new
Steps to reproduce
this is my component and i can't get element value when my component tag is router-link, any idea?
<script setup lang="ts"> /** * for compile icons we use PrIcon components, and * it will create the span tag and put icon svg into it * but when there is no default slots icons must compile directly into self link * with no span tag, so in future we must remove addition span tag * when there is no default slots defined */ import {computed, onMounted, ref, useSlots, watchEffect} from "vue"; import { buttonClassObject } from "@bs/scripts/util/classes"; import PrIcon from "@bc/core/icon.vue"; import {icon, IconElement} from "../../src/scripts/util/util"; // must remove with future release of vue and must use as // import { ButtonPropsType } from "@bs/scripts/util/props"; interface ButtonPropsType { tag?: 'router-link' | 'a', to?: string, href?: string, default?: boolean, primary?: boolean, secondary?: boolean, muted?: boolean, xSmall?: boolean, rounded?: boolean, circle?: boolean, collapse?: boolean, icon?: string, ratio?: number, } const props = withDefaults(defineProps(), { tag: 'router-link' }) // define button classes from defined props const buttonClass = computed(() => buttonClassObject(props)) const slots = useSlots() const el = ref(null) function setIcon() { icon(el.value, props.icon, props.ratio) } onMounted(() => { watchEffect(setIcon) }) </script>i also put my project link to help me.
What is expected?
get element.value when component is router-link
What is actually happening?
cant get el.value when component is router-link
Beta Was this translation helpful? Give feedback.
All reactions