Skip to content

Commit 6d8ec36

Browse files
committed
🎈 perf: 优化嵌入界面显示
1 parent 77a5b61 commit 6d8ec36

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

game/embed/src/index.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -221,46 +221,44 @@ function registerGameButton() {
221221
const style = document.createElement('style');
222222
const rootSelector = `a[href*="${scriptSrc.hostname}/#/"]`
223223
style.innerHTML = `
224-
${rootSelector} {
225-
border-radius: 30px;
226-
display: flex;
227-
flex-direction: row;
224+
${rootSelector}, ${rootSelector}>span>span {
225+
display: inline-flex;
226+
flex-direction: column;
228227
align-items: center;
229228
justify-content: center;
230-
gap: 8px;
231-
padding: 8px 12px 0;
232-
color: white;
229+
gap: 2px;
230+
padding: 0 8px;
231+
color: inherit;
233232
text-decoration: none;
234233
}
235234
${rootSelector}:hover {
236235
transform: scale(1.1);
237236
}
238237
${rootSelector} img {
239-
width: 46px;
240-
height: 46px;
238+
width: 50px;
241239
pointer-events: none;
242240
}
243241
${rootSelector}>span {
244242
display: inline-flex;
245-
flex-direction: column;
243+
flex-direction: row;
246244
align-items: center;
247245
justify-content: center;
248246
font-size: 12px;
249247
line-height: 1.2;
250248
text-align: center;
251249
}
252-
${rootSelector}>span abbr {
250+
${rootSelector}>span>span abbr {
253251
text-decoration: none;
254252
}
255-
${rootSelector}>span span {
253+
${rootSelector}>span>span span {
256254
margin-top: 2px;
257255
padding: 3px 8px;
258256
cursor: pointer;
259257
background: #4CAF50;
260258
border-radius: 12px;
261259
font-weight: bold;
262260
}
263-
${rootSelector} + span {
261+
${rootSelector}>span + span {
264262
margin-left: 8px;
265263
font-size: 12px;
266264
vertical-align: middle;

game/frontend/src/components/common/RoomControls.vue

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
</template>
6767
<button
6868
v-if="!gameStore.player?.isVisitor"
69-
class="btn btn-soft btn-circle md:btn-lg btn-info tooltip tooltip-left"
69+
class="btn btn-soft btn-circle md:btn-lg btn-secondary tooltip tooltip-left"
7070
@click="shareRoom"
7171
data-tip="分享房间"
7272
>
@@ -115,13 +115,16 @@ const isRoomFull = computed(() => {
115115
const ComponentLite = computed(() => getComponent(gameStore.roomPlayer?.room.attrs?.type, 'Lite'))
116116
117117
const roomShareCode = computed(() => `<a target="_blank" href="${location.origin}/#/${ComponentLite.value ? 'l': 'r'}/${gameStore.roomPlayer?.room.id}">
118-
<img src="${location.origin}/logo.png" alt="Tiaoom" />
119-
<span>
120-
<abbr>${gameStore.games[gameStore.roomPlayer?.room.attrs?.type]?.name || '未知'}</abbr>
121-
<span>加入游戏</span>
118+
<span>
119+
<img src="${location.origin}/logo.png" alt="Tiaoom" />
120+
<span>
121+
<abbr>${gameStore.games[gameStore.roomPlayer?.room.attrs?.type]?.name || '未知'}</abbr>
122+
<span>加入游戏</span>
123+
</span>
122124
</span>
125+
<span>#${gameStore.roomPlayer?.room.name}</span>
123126
</a>
124-
<span>#${gameStore.roomPlayer?.room.name}</span>`)
127+
`)
125128
126129
async function shareRoom() {
127130
try {

0 commit comments

Comments
 (0)