-
-
Save kurotanshi/348d2f044348a9e7aa8e24313267ca84 to your computer and use it in GitHub Desktop.
Vuex 整合實戰!以口罩地圖為例 - step - 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <div id="app"> | |
| <!-- aside-menu 左側欄 --> | |
| <div class="aside-menu"> | |
| <div class="wraps"> | |
| <label> | |
| 縣市:<select><option>台北市</option></select> | |
| </label> | |
| <label> | |
| 行政區:<select><option>北投區</option></select> | |
| </label> | |
| </div> | |
| <div class="wraps"> | |
| <label> | |
| <i class="fas fa-search-location"></i> 關鍵字搜尋: | |
| <input type="text" placeholder="請輸入關鍵字"> | |
| </label> | |
| </div> | |
| <ul class="store-lists"> | |
| <li class="store-info wraps"> | |
| <h1>XX藥局</h1> | |
| <div class="mask-info"> | |
| <i class="fas fa-head-side-mask"></i> | |
| <span>大人口罩: 100 個</span> | |
| </div> | |
| <div class="mask-info"> | |
| <i class="fas fa-baby"></i> | |
| <span>兒童口罩: 100 個</span> | |
| </div> | |
| <div class="mask-info"> | |
| 最後更新時間: | |
| </div> | |
| <button class="btn-store-detail"> | |
| <i class="fas fa-info-circle"></i> | |
| 看詳細資訊 | |
| </button> | |
| </li> | |
| <li class="store-info wraps"> | |
| <h1>XX藥局</h1> | |
| <div class="mask-info"> | |
| <i class="fas fa-head-side-mask"></i> | |
| <span>大人口罩: 100 個</span> | |
| </div> | |
| <div class="mask-info"> | |
| <i class="fas fa-baby"></i> | |
| <span>兒童口罩: 100 個</span> | |
| </div> | |
| <div class="mask-info"> | |
| 最後更新時間: | |
| </div> | |
| <button class="btn-store-detail"> | |
| <i class="fas fa-info-circle"></i> | |
| 看詳細資訊 | |
| </button> | |
| </li> | |
| <li class="store-info wraps"> | |
| <h1>XX藥局</h1> | |
| <div class="mask-info"> | |
| <i class="fas fa-head-side-mask"></i> | |
| <span>大人口罩: 100 個</span> | |
| </div> | |
| <div class="mask-info"> | |
| <i class="fas fa-baby"></i> | |
| <span>兒童口罩: 100 個</span> | |
| </div> | |
| <div class="mask-info"> | |
| 最後更新時間: | |
| </div> | |
| <button class="btn-store-detail"> | |
| <i class="fas fa-info-circle"></i> | |
| 看詳細資訊 | |
| </button> | |
| </li> | |
| </ul> | |
| </div> | |
| <!-- 地圖區塊 --> | |
| <div class="mask-map" id="mask-map"></div> | |
| </div> | |
| </template> | |
| <script> | |
| export default { | |
| name: 'App', | |
| } | |
| </script> | |
| <style lang="scss" src="./style.scss"></style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #app { | |
| display: block; | |
| position: fixed; | |
| overflow: hidden; | |
| width: 100%; | |
| height: 100vh; | |
| * { | |
| box-sizing: border-box; | |
| } | |
| > div { | |
| float: left; | |
| } | |
| } | |
| .aside-menu { | |
| width: 25%; | |
| height: 100%; | |
| border-right: 1px solid #aaa; | |
| background-color: #f1f1f1; | |
| overflow-y: scroll; | |
| label { | |
| position: relative; | |
| margin-right: 2em; | |
| display: block; | |
| font-size: 1.2rem; | |
| line-height: 2; | |
| } | |
| select { | |
| position: absolute; | |
| margin-top: 0.3rem; | |
| left: 6rem; | |
| font-size: 1.2rem; | |
| width: auto; | |
| min-width: 110px; | |
| } | |
| input { | |
| padding: 2px 8px; | |
| font-size: 1.2rem; | |
| line-height: 2; | |
| width: 110%; | |
| } | |
| } | |
| .mask-map { | |
| position: relative; | |
| width: 75%; | |
| height: 100%; | |
| background-color: #aaa; | |
| z-index: 10; | |
| &.full { | |
| width: 100%; | |
| } | |
| } | |
| .wraps { | |
| padding: 1em; | |
| border-bottom: 1px solid #666; | |
| } | |
| .store-info { | |
| position: relative; | |
| cursor: pointer; | |
| font-size: 1.1rem; | |
| line-height: 1.8; | |
| background-color: #fff; | |
| h1 { | |
| font-size: 1.5rem; | |
| font-weight: 500; | |
| color: #333; | |
| margin-bottom: 0.3em; | |
| } | |
| .mask-info{ | |
| position: relative; | |
| > span { | |
| position: absolute; | |
| left: 1.8rem; | |
| } | |
| } | |
| &::v-deep .highlight { | |
| color: #f08d49; | |
| } | |
| &:hover { | |
| background-color: #eee; | |
| } | |
| .btn-store-detail { | |
| position: absolute; | |
| display: block; | |
| cursor: pointer; | |
| width: 80px; | |
| height: 80px; | |
| text-align: center; | |
| right: 1.2rem; | |
| top: 1.5rem; | |
| font-size: .8rem; | |
| > i { | |
| display: block; | |
| font-size: 2rem; | |
| margin-bottom: 5px; | |
| } | |
| } | |
| } | |
| .popup-name { | |
| font-size: 1.25rem; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment