admin管理员组文章数量:1332890
The size Quasar Button ponent can be adjusted and from docs it seems the icon in a button should change size accordingly. See this picture for example from the docs:
When I try the icon stays same size (button changes). My code:
<q-btn
v-if="$route.name === 'resetpassword'"
class="absolute-top-right"
flat
round
wait-for-ripple
dense
size="15px"
color="primary"
icon="mdi-window-close"
@click.native="goToSignIn"
/>
What's wrong?
The size Quasar Button ponent can be adjusted and from docs it seems the icon in a button should change size accordingly. See this picture for example from the docs:
When I try the icon stays same size (button changes). My code:
<q-btn
v-if="$route.name === 'resetpassword'"
class="absolute-top-right"
flat
round
wait-for-ripple
dense
size="15px"
color="primary"
icon="mdi-window-close"
@click.native="goToSignIn"
/>
What's wrong?
Share Improve this question edited Nov 12, 2021 at 18:56 Super Kai - Kazuya Ito 1 asked May 4, 2018 at 9:26 musicformellonsmusicformellons 13.4k5 gold badges57 silver badges94 bronze badges3 Answers
Reset to default 31. The Problem
I ran into the same problem today. But if you change the button size to an extreme number (e.g. 200px), you'll see that the icon DID change size with the button.
The problem is that the default padding area between the icon and the button is too big, which makes the icon look small paring to the button itself.
2. The Solution
Here's how I solve it using Deep Selectors. You make a custom button ponent around your button code. Then give it following style:
<style scoped>
.q-btn>>>.q-icon {
font-size: 40px;
}
</style>
And also give the size attribute in your template the same size, so size="40px"
. Then all aspects of the button have same size.
When using Vue with 3rd party UI Frameworks/Components, Deep Selector
makes it really easy to make quick changes to ponent styles. And the changes can also be scoped (only change style locally) if you put the scoped
keyword.
A good solution is to use q-icon
inside q-btn
for changing the size of the icon.
<q-btn size="xs" color="primary" dense>
<q-icon name="add" size="15px"></q-icon>
</q-btn>
I used Quasar v2.0.4
. With Quasar v2.0.4
, you can change the icon(or button) size with size attribute
.
For example:
<q-btn size="xl" icon="close" />
<q-btn size="100px" icon="close" />
But if you use size attribute
with fab
or fab-mini attribute
, size attribute
doesn't work, then, only fab
or fab-mini attribute
works instead of size attribute
.
For example:
<q-btn size="xl" fab icon="close" />
<q-btn size="100px" fab-mini icon="close" />
本文标签: javascriptIcon in Quasar Button Component does not change sizeStack Overflow
版权声明:本文标题:javascript - Icon in Quasar Button Component does not change size - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742308435a2450385.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论