How to use vue-class-component - 10 common examples

To help you get started, we’ve selected a few vue-class-component examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github toyobayashi / mishiro / app / src / ts / renderer / modal-score.ts View on Github external
import InputRadio from '../../vue/component/InputRadio.vue'

import modalMixin from './modal-mixin'
import Component, { mixins } from 'vue-class-component'

const { remote } = window.node.electron
const getPath = window.preload.getPath
const { scoreDir, liveDir } = getPath
const url = window.node.url

@Component({
  components: {
    InputRadio
  }
})
export default class extends mixins(modalMixin) {
  difficulty: string = '4'
  live: any = {}
  difficulties: { [key: string]: string } = {}

  async start () {
    this.playSe(this.enterSe)
    const res = await window.preload.getScore(
      scoreDir(this.live.score), // scoreFile)
      this.difficulty, // difficulty
      this.live.bpm, // bpm
      liveDir(this.live.fileName) // audioFile
    )
    if (!res) return

    this.event.$emit('gameStart')
    this.event.$emit('pauseBgm')
github roblav96 / robinhood.tools / src / client / routes / symbol / symbol.ticker.ts View on Github external
import * as Vts from 'vue-property-decorator'
import { mixins as Mixins } from 'vue-class-component'
import Vue from 'vue'
import Symbol from './symbol'
import VMixin from '../../mixins/v.mixin'
import * as _ from '../../../common/lodash'
import * as core from '../../../common/core'
import * as rkeys from '../../../common/rkeys'
import * as http from '../../../common/http'
import * as utils from '../../adapters/utils'
import socket from '../../adapters/socket'



@Vts.Component
export default class extends Mixins(VMixin) {
	$parent: Symbol
	symbol = this.$parent.symbol
	all = this.$parent.all

	deals = [] as Quotes.Deal[]

	created() {
		// this.syncdeals()
	}

	beforeDestroy() {
		socket.offListener(this.ondeal, this)
		this.deals.splice(0)
	}

	syncdeals() {
github gamejolt / frontend-lib / components / route / route-store.ts View on Github external
export function WithRouteStore(options: RouteStoreOptions) {
	return createDecorator(componentOptions => {
		// Store the options passed in.
		componentOptions.routeStoreOptions = {
			...componentOptions.routeStoreOptions,
			...options,
		};

		// We unshift so that this always goes first before the RouteResolver
		// callback.
		componentOptions.mixins = componentOptions.mixins || [];
		componentOptions.mixins.unshift({
			beforeRouteEnter(route, _from, next) {
				const options = componentOptions.routeStoreOptions;
				if (options) {
					const { store, routeStoreClass, routeStoreName } = options;
					store.registerModule(routeStoreName, new routeStoreClass());
github electron-userland / electrify / src / renderer / router.ts View on Github external
import Vue from "vue"
import Component from "vue-class-component"
import Router from "vue-router"

Vue.use(Router)

// you have to register the hooks before component definition
Component.registerHooks(["beforeRouteEnter", "beforeRouteUpdate", "beforeRouteLeave", "beforeRouteLeave"])

export default new Router({
  routes: [
    {
      path: "/",
      redirect: "/project/prerequisites"
    },
    {
      path: "/project",
      redirect: "/project/prerequisites",
      component: () => import(/* webpackMode: "eager" */ "./components/project.vue"),
      children: [
        {
          path: "prerequisites",
          component: () => import(/* webpackChunkName: "project" */ "./components/prerequisites.vue")
        },
github project-yuki / YUKI / src / translator / class-component-hooks.ts View on Github external
// class-component-hooks.js
import Component from 'vue-class-component'

// Register the router hooks with their names
Component.registerHooks([
  'beforeRouteEnter',
  'beforeRouteLeave',
  'beforeRouteUpdate' // for vue-router 2.2+
])
github vueneue / vueneue / packages / @vueneue / ssr-core / neuets.ts View on Github external
/// 

import Vue from 'vue';
import Component, { mixins, createDecorator } from 'vue-class-component';

export { Vue, Component, mixins, createDecorator };
export * from 'vue-property-decorator';
export * from 'vuex-class';

Component.registerHooks([
  'beforeRouteEnter',
  'beforeRouteUpdate',
  'beforeRouteLeave',
  'asyncData',
  'head',
  'middlewares',
]);
github Mitscherlich / hexo-theme-amber / src / enhanceApp.ts View on Github external
Vue.use(mixins);

// use dayjs
import date from './plugins/date';
Vue.use(date);

// use markdown-it
import markdown from './plugins/markdown';
Vue.use(markdown);

// use nprogress
import nprogress from './plugins/nprogress';
Vue.use(nprogress);

// register hooks
Components.registerHooks([
  'fetch',
]);
github akoidan / pychat / fe / src / utils / classComponentHooks.ts View on Github external
import Component from 'vue-class-component';

// Register the router hooks with their names
Component.registerHooks([
  'beforeRouteEnter',
  'beforeRouteLeave',
  'beforeRouteUpdate' // for vue-router 2.2+
]);

vue-class-component

ES201X/TypeScript class decorator for Vue components

MIT
Latest version published 4 years ago

Package Health Score

64 / 100
Full package analysis