Skip to content

Instantly share code, notes, and snippets.

@tiggreen
Created March 9, 2018 14:43
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tiggreen/b49271a9278bf9f73a7222ccf7730d06 to your computer and use it in GitHub Desktop.
Save tiggreen/b49271a9278bf9f73a7222ccf7730d06 to your computer and use it in GitHub Desktop.
Simple Vue.js tab navigation component with Bulma
<template>
<div class="container">
<div class="columns">
<div class="column is-12">
<div class="tabs help-tabs">
<ul>
<li :class="[ lang === 'crontab' ? 'is-active' : '']"><a @click="lang='crontab'">Crontab</a>
</li>
<li :class="[ lang === 'php' ? 'is-active' : '']"><a @click="lang='php'">PHP</a></li>
<li :class="[ lang === 'bash' ? 'is-active' : '']"><a @click="lang='bash'">Bash</a></li>
<li :class="[ lang === 'python' ? 'is-active' : '']"><a @click="lang='python'">Python</a></li>
</ul>
</div>
<div class="box help-content">
<code v-if="lang ==='crontab'">
{{monitor.schedule}} your_script.sh && curl -fsS --retry 3 {{monitor.url_code}>
/dev/null
</code>
<code v-if="lang ==='php'">
file_get_contents({{monitor.url_code}});
</code>
<code v-if="lang ==='bash'">
curl --retry 2 {{monitor.url_code}}
</code>
<code v-if="lang ==='python'">
# using urllib2:
import urllib2
urllib2.urlopen("{{monitor.url_code}}")
</pre>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'HelpComponent',
data() {
return {
monitor: {
schedule: '* * * * *',
url_code: 'https://cronhub.io/random_uuid',
},
lang: 'crontab',
}
},
}
</script>
<style lang="css" scoped>
.help-content {
background-color: white !important;
}
.help-tabs {
margin-bottom: 10px !important;
}
.tabs li.is-active a {
border-bottom-color: #000000;
color: #7763A9;
border-bottom: 3px solid;
font-weight: bold;
}
code, pre {
color: #1b1e21 !important;
background-color: white !important;
}
</style>
@adamdahan
Copy link

Thanks - this helped me a lot 👍

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