基础使用
<script setup>
import { ref } from 'vue'
const show = ref(false)
</script>
<template>
<CButton
label="点击打开抽屉"
@click="show = true"
/>
<CDrawer
v-model="show"
title="你好"
>
我是一些抽屉内容
</CDrawer>
</template>
不同位置
<script setup>
import { ref } from 'vue'
import {
matArrowBack,
matArrowDownward,
matArrowForward,
matArrowUpward,
} from '@quasar/extras/material-icons/index'
const show = ref(false)
const position = ref('left')
function openWithPosition(pos) {
position.value = pos
show.value = true
}
</script>
<template>
<div class="c-flex c-gutter-md c-wrap">
<div>
<c-button
icon
@click="openWithPosition('left')"
>
<c-icon :content="matArrowBack" />
</c-button>
</div>
<div>
<c-button
icon
@click="openWithPosition('top')"
>
<c-icon :content="matArrowUpward" />
</c-button>
</div>
<div>
<c-button
icon
@click="openWithPosition('right')"
>
<c-icon :content="matArrowForward" />
</c-button>
</div>
<div>
<c-button
icon
@click="openWithPosition('bottom')"
>
<c-icon :content="matArrowDownward" />
</c-button>
</div>
</div>
<c-drawer
v-model="show"
title="你好"
:position="position"
>
我是一些抽屉内容
</c-drawer>
</template>
CDrawer API
"left"
| "top"
| "right"
| "bottom"
默认值 'left'
抽屉弹出位置