Skip to content

Instantly share code, notes, and snippets.

<template>
<iconLove class="icon-large icon-red" />
</template>
<style>
.icon-red path {
fill: red;
}
</style>
<template>
<iconLove class="icon-large" />
</template>
<style>
.icon-large {
width: 48px;
height: 48px;
}
.icon-default {
@artrayd
artrayd / App.vue
Last active January 15, 2022 09:44
Register SVG Icon component
<template>
<h1>SVG Icon Font</h1>
<p>You can easily customize these icons with CSS only</p>
<iconLove />
</template>
<script>
import svgLove from "./components/icon/Love.vue";
export default {
name: "App",
@artrayd
artrayd / gist:fc1a108b479e746bcbc57a78bbc6e651
Last active January 15, 2022 08:44
Empty VueJS Component
<template>
<div></div>
</template>
<script>
export default {
name: "Love",
};
</script>
@artrayd
artrayd / index.js
Created September 23, 2020 21:05 — forked from wdmtech/index.js
Facebook SDK (Graph/REST API) integration as a Vue.js mixin
export let facebookSDK = {
mounted () {
let _this = this
this.$nextTick(() => {
window.fbAsyncInit = function () {
FB.init({
appId: 'XXX',
xfbml: true,
version: 'v2.6'
})
// inside html template
<span>{{ lettersAmount }} letters</span>
// inside script
computed: {
lettersAmount: function() {
return this.letters.length;
},
},
<img :src="letterIcon(letter.path)" />
@artrayd
artrayd / alphabet-3.vue
Last active July 2, 2020 08:57
Require image src path for v-loop
methods: {
letterIcon: function(path) {
return require("@/" + path);
},
},
<template>
<ul class="alphabet">
<li v-for="letter in letters" :key="letter.name">
<img :src="letterIcon(letter.path)" />
<span>{{ letter.name }}</span>
<div class="tooltip">{{ letter.alt }}</div>
</li>
</ul>
</template>
@artrayd
artrayd / alphabet-1.vue
Last active July 2, 2020 08:56
Importing array from local JSON file to Vue
// Importing array from local JSON file
import json from "@/assets/letters/greek-alphabet.json";
export default {
name: "Alphabet",
data: function() {
return {
letters: json.letters, // passing array data into Vue
};
},