A fast intro to the front-end development, why we chose Vue and how we use it in IBM Q Experience
+
Bundlers (webpack, parcel...)
CSS pre/post processor (SASS, Less... CSS-in-JS?)
API calls (Rest, Graphql...)
Server-side rendering
Testing (test runners, headless browsers...)
Browser compatibility (Polyfills)
Typescript
Easier to learn for beginners
Just that!
Progressive framework (router, vuex, ssr...)
SFC components:
Reactivity
Props
Events
<template>
<div>
<!-- HTML is here -->
</div>
</template>
<script>
export default {
// definition
name: '',
mixins: [],
components: [],
// data
props: {},
data() {},
computed: {},
watch: {},
// life cycle
created() {},
mounted() {},
destroyed() {},
// methods
methods: {}
}
</script>
<style>
div {
background-color: blue;
}
</style>
<docs>
// Hey! I'm a custom block
</docs>
<template>
<div>
<p v-if="seen">Now you see me</p>
<a :href="url" @click="doSomething">
{{ linkMessage | capitalize }}
</a>
<ul id="example-1">
<li v-for="item in items" :key="item.id">
{{ item.message }}
</li>
</ul>
<i-am-a-component :prop="value">
<slot name="title">
<h1>Title!</h1>
</slot>
</i-am-a-component>
</div>
</template><script>
import BaseInputText from './BaseInputText.vue'
import TodoListItem from './TodoListItem.vue'
let nextTodoId = 1
export default {
components: {
BaseInputText, TodoListItem
},
data () {
return {
newTodoText: '',
todos: [
{
id: nextTodoId++,
text: 'Learn Vue'
}
]
}
},
methods: {
addTodo () {
// content not here !
},
removeTodo (idToRemove) {
this.todos = this.todos.filter(todo => {
return todo.id !== idToRemove
})
}
}
}
</script><style lang="scss" scoped>
@import '../variables.scss';
.input {
width: 100%;
padding: 8px 10px;
border: 1px solid $vue-blue;
}
</style>const User = {
template: `
<div class="user">
<h2>User {{ $route.params.id }}</h2>
<router-view></router-view>
</div>
`
};
const router = new VueRouter({
routes: [
{ path: '/user/:id', component: User,
children: [
{
// UserProfile will be rendered inside User's <router-view>
// when /user/:id/profile is matched
path: 'profile',
component: UserProfile
},
{
// UserPosts will be rendered inside User's <router-view>
// when /user/:id/posts is matched
path: 'posts',
component: UserPosts
}
]
}
]
});OPENQASM 2.0;
include "qelib1.inc";
qreg q[2];
creg c[2];
h q[0];
cx q[0],q[1];
measure q[0] -> c[0];
measure q[1] -> c[1];class Circuit {
constructor() {
this.classicalRegisters = [],
this.qubitsRegisters = [];
this.gates = [];
}
}Based on qiskit-vscode using ANTLR4
Lexic & semantic analyzer
class Circuit {
constructor() {
this.classicalRegisters = [],
this.qubitsRegisters = [];
this.gates = [];
}
}Visualizer
SVG Drawer
SVG Circuit Drawer
Gates
Dynamic
Z
H
@update
@subroutineAdded
@error
Gates Drop Area
Visualizer
SVG Drawer
😄