Skip to content

Commit 3a2a72e

Browse files
committed
fix(QIcon): QBtn with QIcon with img doesn't render properly quasarframework#12016
1 parent ebdb8e0 commit 3a2a72e

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

ui/dev/src/pages/components/icon.vue

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
<!-- Testing for 'M.' -->
4242
<q-icon :name="oiBatteryEmpty" size="5rem" color="secondary" />
4343

44+
<q-btn id="showInfoBtn" no-caps class="q-ml-sm">
45+
<q-icon size="2em" name="img:https://www.gfbr.global/wp-content/uploads/2015/10/TwitterLogo_55acee-49x49.png" />
46+
</q-btn>
47+
4448
<q-space />
4549

4650
<q-expansion-item
@@ -284,3 +288,14 @@ export default {
284288
}
285289
}
286290
</script>
291+
292+
<style>
293+
#showInfoBtn {
294+
position: absolute;
295+
top: 4px;
296+
right: 40px;
297+
z-index: 3;
298+
width: 36px;
299+
height: 36px;
300+
}
301+
</style>

ui/src/components/icon/QIcon.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,15 @@ export default Vue.extend({
173173
}
174174

175175
if (this.type.img === true) {
176-
return h('div', data, mergeSlot([
176+
return h('span', data, mergeSlot([
177177
h('img', {
178178
attrs: { src: this.type.src }
179179
})
180180
], this, 'default'))
181181
}
182182

183183
if (this.type.svg === true) {
184-
return h('div', data, mergeSlot([
184+
return h('span', data, mergeSlot([
185185
h('svg', {
186186
attrs: {
187187
viewBox: this.type.viewBox,
@@ -192,7 +192,7 @@ export default Vue.extend({
192192
}
193193

194194
if (this.type.svguse === true) {
195-
return h('div', data, mergeSlot([
195+
return h('span', data, mergeSlot([
196196
h('svg', {
197197
attrs: {
198198
viewBox: this.type.viewBox,

ui/src/components/icon/QIcon.sass

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121

2222
> svg,
2323
> img
24-
width: 100%
25-
height: 100%
24+
width: 1em
25+
height: 1em
2626

2727
.q-icon,
2828
.material-icons,

ui/src/components/icon/QIcon.styl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121

2222
> svg,
2323
> img
24-
width: 100%
25-
height: 100%
24+
width: 1em
25+
height: 1em
2626

2727
.q-icon,
2828
.material-icons,

0 commit comments

Comments
 (0)