This file contains 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
import { ref } from 'vue' | |
export default function(uri) { | |
const data = ref(null); | |
const getData = async () => { | |
try { | |
const result = await fetch(uri); | |
if(!result.ok) { |
This file contains 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
import { ref } from 'vue' | |
export default function() { | |
const users = ref(null); | |
const getData = async () => { | |
try { | |
const data = await fetch('https://jsonplaceholder.typicode.com/users'); | |
if(!data.ok) { |
This file contains 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> | |
<p ref="msg"></p> | |
<button type="button" | |
@click="changeMsg">click me</button> | |
</div> | |
</template> | |
<script> | |
import { ref } from 'vue' |
This file contains 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
// 登入 | |
liff.login({ | |
// 使用者登入後要去到哪個頁面 | |
redirectUri: 'https://www.xxxxxxx.com.tw' | |
}); | |
// 登出 | |
liff.logout(); |
This file contains 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
var liffID = 'XXXXXXXXXXXX'; | |
liff.init({ | |
liffId: liffID | |
}).then(function() { | |
console.log('LIFF init'); | |
// 這邊開始寫使用其他功能 | |
}).catch(function(error) { |
This file contains 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
// *** 放置地圖 | |
let zoom = 17; // 0 - 18 | |
let center = [xxx, xxx]; // 中心點座標 | |
let map = L.map('map').setView(center, zoom); | |
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { | |
attribution: '© OpenStreetMap', // 商用時必須要有版權出處 | |
zoomControl: true , // 是否秀出 - + 按鈕 | |
}).addTo(map); |
This file contains 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
const customIcon = L.icon({ | |
iconUrl: '圖片的 URL', | |
iconSize: [42, 42], | |
}); | |
const marker = L.marker(center, { | |
icon: customIcon, | |
title: '跟 <a> 的 title 一樣', // 跟 <a> 的 title 一樣 | |
opacity: 1.0 | |
}).addTo(map); |
This file contains 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
// 跟使用者要位置 | |
function successGPS(position) { | |
const lat = position.coords.latitude; | |
const lng = position.coords.longitude; | |
center = [lat, lng]; | |
// 接著寫確認了座標後要執行的事 | |
}; | |
function errorGPS() { | |
window.alert('無法判斷您的所在位置,無法使用此功能。預設地點將為 台北市動物園'); | |
// 接著寫使用者「封鎖」位置資訊請求後要執行的事 |
This file contains 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
<div class="embed-responsive embed-responsive-16by9"> | |
<iframe id="player" src="https://www.youtube.com/embed/M7lc1UVf-VE?enablejsapi=1&allowsInlineMediaPlayback=true&playsinline=1"></iframe> | |
</div> | |
<!-- 播放相關按鈕--> | |
<div class="row align-items-center pt-4"> | |
<div class="col text-center"> | |
<div class="btn-group"> | |
<button class="btn btn-outline-dark" id="play" type="button">播放</button> | |
<button class="btn btn-outline-dark" id="pause" type="button">暫停</button> |
This file contains 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
module.exports = { | |
purge: { | |
// 哪些檔案要編譯 | |
content: ['./public/**/*.html', './src/**/*.vue'], | |
// 哪些 class 是白名單 | |
options: { | |
safelist: ['bg-red-500', 'px-4'], | |
} | |
}, |