useQuasar 可组合函数用于访问$q 对象。
语法
import { useQuasar } from 'quasar'
setup () {
const $q = useQuasar()
}
内容粘贴
示例
<template>
<div>
<div v-if="$q.platform.is.ios">
Gets rendered only on iOS platform.
</div>
</div>
</template>
<script>
import { useQuasar } from 'quasar'
export default {
setup () {
const $q = useQuasar()
console.log($q.platform.is.ios)
// showing an example on a method, but
// can be any part of Vue script
function show () {
// prints out Quasar version
console.log($q.version)
}
return {
show
}
}
}
</script>
内容粘贴