Skip to content

Instantly share code, notes, and snippets.

modules: [
'bootstrap-vue/nuxt',
'@nuxtjs/axios',
'@nuxtjs/proxy'
],
axios: {
proxy: true,
prefix: '/api',
credentials: true,
},
modules: [
'@nuxtjs/axios',
'@nuxtjs/proxy'
],
axios: {
proxy: true,
prefix: '/api',
credentials: true,
},
proxy: {
export default function ({ $axios, redirect }) {
//Authorization
$axios.setHeader('Content-Type', 'application/json')
}
plugins: [
'~/plugins/axios'
],
var licenseKeyFormatting = function(S, K) {
let str = S.replace(/-/g, "").toUpperCase() //去除"-"並改成大寫
let result = '' //每次迴圈跑完就對這個空字串添加字符
let countK = 0
for(let i =str.length-1; i >= 0; i--) { //由後往前遍歷字串,起始點是最後一個字,終點是第0個字
letter = str[i]
result += letter
countK ++
if(countK == K){ //如果剛好加到第 K 個,就要再加上"-"
@linxinemily
linxinemily / Chart.js
Created April 13, 2019 10:57
vue-chart.js example
<script>
import { Line, mixins } from 'vue-chartjs'
const { reactiveProp } = mixins
export default {
mixins: [reactiveProp],
extends: Line,
props: { //待會會從父組件傳入圖表資料
chartData: {
type: Object,
<script>
import { Line } from 'vue-chartjs'
export default {
extends: Line,
props: { //待會會從父組件傳入圖表資料
chartData: {
type: Object,
default: () => {}
}
{
labels: ['今天', '昨天', '一週前'], // 位於 x 軸的各筆數據 key
datasets: [
{
label: '排名', // x 軸的標籤項目
backgroundColor: 'rgba(0,0,0,0.1)',
data: ['1', '2', '1'] // 位於 y 軸對應的各筆數據 value
}
]
}
<script>
import { Line, mixins } from 'vue-chartjs'
const { reactiveProp } = mixins
export default {
mixins: [reactiveProp],
extends: Line,
data: () => ({
options: {
responsive: true,
.grid-cell {
display: flex;
align-items: flex-end;
flex-wrap: wrap; // 讓內部 div 當空間不夠時可以自動換行
flex-direction: column; // 讓內部 div 由上往下排列
justify-content: space-between; // 讓內部的 div 內容可以去均分父元素橫的空間
align-content: space-around; // 讓內部的 div 內容可以去均分父元素直的空間
height: 350px; // 要設定固定高度,才會有 wrap 的效果
}