Comments (2)
Thanks. I was aware of this but I didn't tried this because my console log had empty ref value, Check below image:
I think when you use ref on vue component it doesn't give empty ref like above image it logs the component instance and we can inspect the underlying element $el
:
I've updated the reproduction example I guess
Anyways, It indeed solves my query hence closing the issue, Thanks 😇
from shadcn-vue.
Vue still not support forwardRef
.
You can do something like
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { Textarea } from '@/components/ui/textarea';
import { unrefElement } from '@vueuse/core'
const refTextarea = ref();
onMounted(() => {
refTextarea.value.$el.focus()
// or
unrefElement(refTextarea).focus()
});
</script>
<template>
<Textarea ref="refTextarea" placeholder="Type your message here." />
</template>
Related resources
from shadcn-vue.
Related Issues (20)
- [Feature]: Implementation of virtual scroll on listing components (combobox like) HOT 4
- [Bug]: Incorrect Calculation of Drawer Snap Function HOT 1
- [Bug]: Tabs v-model not updating in test utils/vitest HOT 1
- [Bug]: Toast - Failed to load source map for @internationalized/date HOT 5
- [Bug]: [@vue/compiler-sfc] Failed to resolve import source "@/Components/ui/chart". HOT 2
- [Feature]: Include PIN Input to Auto Form
- [Feature]: Add option for icons to the Auto Form inputs
- [Bug]: Form not submitting HOT 3
- [Bug]: npx shadcn-vue@latest Get npm ERR! Invalid Version: HOT 5
- [Bug]: v0.10.5 - Unable to add components using npx HOT 21
- [Bug]: use TooltipProvider in Blocks/Dashboard03,05,06,07
- [Bug]: Pagination component directory not created in latest release HOT 1
- [Bug]: Updated date picker does not let user choose month and year HOT 4
- [Docs]: the broken navigation links for the code examples under the "Form" tab HOT 6
- [Feature]: NumberField
- [Feature]: Create internal frameworks templates for the CLI HOT 1
- [Feature]: remove the need for multiple <script> tags from a single component. HOT 2
- [Bug]: Error in DropdownMenuRadioItem HOT 2
- [Bug]: DonutChart's legend is not shown HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shadcn-vue.