@uni-use/mounted
v1.5.1
Published
Mounted state in ref
Downloads
12
Maintainers
Readme
@uni-use/mounted
A combined api for use mounted state in ref
Installing
# use pnpm
$ pnpm install @uni-use/mounted
# use npm
$ npm install @uni-use/mounted --save
# use yarn
$ yarn add @uni-use/mounted
Usage
1. Using in vue3.x:
<script setup>
import useMounted from '@uni-use/mounted'
const isMounted = useMounted()
defineExpose({
isMounted
})
</script>
2. Using in vue2.7.x:
<script>
import useMounted from '@uni-use/mounted'
export default {
setup() {
const isMounted = useMounted()
return {
isMounted
}
}
}
</script>
3. Use CDN resource
<script src="https://unpkg.com/vue-demi@latest/lib/index.iife.js"></script>
<script src="https://unpkg.com/@uni-use/[email protected]/dist/index.global.prod.js"></script>
<script>
const mounted = useMounted()
// ...
</script>
Support & Issues
Please open an issue here.