Skip to content

Instantly share code, notes, and snippets.

@kurotanshi
Created January 3, 2021 17:37
Show Gist options
  • Select an option

  • Save kurotanshi/e583f2051a5eb1ffc3191252b315bdd1 to your computer and use it in GitHub Desktop.

Select an option

Save kurotanshi/e583f2051a5eb1ffc3191252b315bdd1 to your computer and use it in GitHub Desktop.
Vuex 整合實戰!以口罩地圖為例 - step - 2
<template>
<transition name="modal">
<div class="modal-mask" v-show="showModal">
<div class="modal-wrapper">
<div class="modal-container">
<div class="modal-body">
<!-- 內容放這裡 -->
<div>Hello</div>
</div>
</div>
</div>
</div>
</transition>
</template>
<script>
export default {
name: 'Lightbox',
computed: {
showModal: {
get() {
return this.$store.state.showModal;
},
set(value) {
this.$store.commit('setshowModal', value);
},
},
},
methods: {
close() {
this.showModal = false;
},
},
};
</script>
<style scoped lang="scss">
.modal-mask {
position: fixed;
z-index: 100;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .65);
display: table;
transition: opacity .3s ease;
}
.modal-wrapper {
display: table-cell;
vertical-align: middle;
}
.modal-container {
width: 520px;
margin: 0px auto;
padding: 10px 30px;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
transition: all .3s ease;
font-family: Helvetica, Arial, sans-serif;
}
.modal-body {
color: #42b983;
margin: 20px 0;
}
</style>
<style>
.modal-enter {
opacity: 0;
}
.modal-leave-active {
opacity: 0;
}
.modal-enter .modal-container,
.modal-leave-active .modal-container {
transform: scale(1.1);
}
</style>
<style lang="scss" scoped>
.store-name {
font-size: 1.6rem;
font-weight: bold;
line-height: 1.5;
}
.title{
font-weight: 500;
margin-bottom: .5rem;
line-height: 1.7;
}
table {
border-spacing: 0;
border-radius: 3px;
width: 100%;
margin-bottom: 1rem;
}
th{
background-color: #42b983;
color: #fff;
}
td, th{
padding: .3em;
text-align: center;
line-height: 1.5rem;
}
</style>
@kurotanshi

Copy link
Copy Markdown
Author

更新後的 HTML

<div class="modal-body">
  <h1 class="store-name">藥局名稱</h1>
  <hr>
  <h2 class="title">營業時間</h2>
  <table>
    <thead>
      <tr>
        <th></th>
        <th>ㄧ</th>
        <th>二</th>
        <th>三</th>
        <th>四</th>
        <th>五</th>
        <th>六</th>
        <th>日</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <th>早上</th>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
      </tr>
      <tr>
        <th>中午</th>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
      </tr>
      <tr>
        <th>晚上</th>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
      </tr>
    </tbody>
  </table>

  <h2 class="title">地址 XXXXXXX</h2>
  <h2 class="title">電話 XXXXXXX</h2>
  <h2 class="title">備註 XXXXXXX</h2>
</div>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment