Skip to content

Commit 3b14bd9

Browse files
committed
refactor(CSS): make styling scoped
Allowing shorter CSS class names but mainly making it harder to override component styling. The CSS is carefully engineered to match any use case. Single overrides can break everything on certain platforms or edge cases. Any layout customization should be possible without overrides. BREAKING CHANGE: Overriding `.qrcode-stream*` CSS classes won't work anymore. Try to apply styling without overrides.
1 parent 927c92a commit 3b14bd9

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

src/components/QrcodeStream.vue

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<template lang="html">
2-
<div class="qrcode-stream">
3-
<div class="qrcode-stream__inner-wrapper">
2+
<div class="wrapper">
3+
<div class="inside">
44
<video
55
ref="video"
66
v-show="shouldScan"
7-
class="qrcode-stream__camera"
7+
class="camera"
88
autoplay
99
muted
1010
playsinline
@@ -13,15 +13,15 @@
1313
<canvas
1414
ref="pauseFrame"
1515
v-show="!shouldScan"
16-
class="qrcode-stream__pause-frame"
16+
class="pause-frame"
1717
></canvas>
1818

1919
<canvas
2020
ref="trackingLayer"
21-
class="qrcode-stream__tracking-layer"
21+
class="tracking-layer"
2222
></canvas>
2323

24-
<div class="qrcode-stream__overlay">
24+
<div class="overlay">
2525
<slot></slot>
2626
</div>
2727
</div>
@@ -283,32 +283,30 @@ export default {
283283
};
284284
</script>
285285

286-
<style lang="css">
287-
.qrcode-stream {
286+
<style lang="css" scoped>
287+
.wrapper {
288288
display: flex;
289289
flex-flow: row nowrap;
290290
justify-content: space-around;
291291
align-items: center;
292292
}
293293
294-
.qrcode-stream__inner-wrapper {
294+
.inside {
295295
position: relative;
296296
max-width: 100%;
297297
max-height: 100%;
298298
z-index: 0;
299299
}
300300
301-
.qrcode-stream__overlay,
302-
.qrcode-stream__tracking-layer {
301+
.overlay, .tracking-layer {
303302
position: absolute;
304303
width: 100%;
305304
height: 100%;
306305
top: 0;
307306
left: 0;
308307
}
309308
310-
.qrcode-stream__camera,
311-
.qrcode-stream__pause-frame {
309+
.camera, .pause-frame {
312310
display: block;
313311
object-fit: contain;
314312
max-width: 100%;

0 commit comments

Comments
 (0)