当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript vue.use函数代码示例

本文整理汇总了TypeScript中vue.use函数的典型用法代码示例。如果您正苦于以下问题:TypeScript use函数的具体用法?TypeScript use怎么用?TypeScript use使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了use函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: require

(function () {
    var Vue = require('vue')
    if (!Vue) {
        var message = 'Vue not installed'
        alert(message)
        throw new Error(message)
    }
    Vue.use(require('../../src'))
})()
开发者ID:diogoponce,项目名称:vue-window,代码行数:9,代码来源:index.ts

示例2: default

export default ({ env }) => {
  Vue.use(VueGoogleMaps, {
    load: {
      key: env.GOOGLE_MAPS_API_KEY,
      libraries: 'places',
      language: 'en'
    }
  })
}
开发者ID:WWDCScholars,项目名称:WWDCScholars-form,代码行数:9,代码来源:vue2-google-maps.ts

示例3: before

  before(() => {
    Vue.use(VueRouter)
    directiveTest = new ComponentTest('<div><navbar></navbar><router-view>loading...</router-view></div>', { 'navbar': MockNavbarComponent })

    let homeComponent = { template: '<div class="home">Home</div>' }
    let aboutComponent = { template: '<div class="about">About</div>' }
    let listComponent = { template: '<div class="list">List</div>' }

    router = new VueRouter({
      routes: [
        { path: '/', component: homeComponent },
        { path: '/about', component: aboutComponent },
        { path: '/list', component: listComponent }
      ]
    })
  })
开发者ID:phocea13,项目名称:cojean-wedding,代码行数:16,代码来源:navbar.spec.ts

示例4: function

    run: function (app) {

        Vue.config.debug = true;
        Vue.config.async = false;
        
        Vue.use(VueRouter);
        Vue.component('vue-logo', vueLogo);
        Vue.component('materialize-logo', materializeLogo);
        Vue.component('doc-api', docApi);
        Vue.component('doc-sources', docSources);
        Vue.component('doc-snippet', docSnippet);
        Vue.component('doc-tabs', docTabs);

        var router = new VueRouter({
            history: false,
            root: '/'
        });

        router.map(mapping);

        router.start(App, app);
    },
开发者ID:Pandahisham,项目名称:material-components,代码行数:22,代码来源:index.ts

示例5:

// https://vuex.vuejs.org/zh-cn/intro.html
// make sure to call Vue.use(Vuex) if using a module system
import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex as any)

const store = new Vuex.Store({
  state: {
    count: 0
  },
  mutations: {
    increment: (state) => {
      const obj = state
      obj.count += 1
    },
    decrement: (state) => {
      const obj = state
      obj.count -= 1
    }
  }
})

export default store
开发者ID:hgt803,项目名称:mpvue-ts-demo,代码行数:24,代码来源:store.ts

示例6:

import vuexI18n, { i18nState } from "vuex-i18n";

// declare interface for store's root state
interface RootState {
    i18n: i18nState;
}

// initialize the vuex store using the vuex module. note that you can change the
// name of the module if you wish
const store = new Store<RootState>({});

// initialize the internationalization plugin on the vue instance. note that
// the store must be passed to the plugin. the plugin will then generate some
// helper functions for components (i.e. this.$i18n.set, this.$t) and on the vue
// instance (i.e. Vue.i18n.set).
Vue.use(vuexI18n.plugin, store);

// please note that you must specify the name of the vuex module if it is
// different from i18n. i.e. Vue.use(vuexI18n.plugin, store, "myName")

// add some translations (could also be loaded from a separate file)
// note that it is possible to use placeholders. translations can also be
// structured as object trees and will automatically be flattened by the the
// plugin
const translationsEn = {
  content: "This is some {type} content",
  tree: {
    nested: "This is nested content"
  }
};
开发者ID:Jeremy-F,项目名称:DefinitelyTyped,代码行数:30,代码来源:vuex-i18n-tests.ts

示例7:

import Vue from 'vue';
import VueScrollActive from 'vue-scrollactive';

Vue.use(VueScrollActive);

export default {};
开发者ID:vaskevich,项目名称:osv.im,代码行数:6,代码来源:vendor.ts

示例8: random

/// <reference types="../../node" />

const assert = console.assert;
const random = () => Math.trunc(Math.exp(Math.log(Date.now()) * Math.random()));

import * as Vue from 'vue';
import * as VueI18n from 'vue-i18n';
import { ComponentOptions } from 'vue';

/**
 * VueI18n.install
 */
Vue.use(VueI18n);
VueI18n.install(Vue);

/**
 * VueI18n.version
 */
assert(typeof VueI18n.version === 'string');

/**
 * VueI18n Instance
 */
const locale = random().toString();
const key = `_${random()}`;
const value = `${random()}|${random()}|${random()}`;
const i18n = new VueI18n({
  locale,
  fallbackLocale: locale,
  messages: {
    [locale]: {
开发者ID:Crevil,项目名称:DefinitelyTyped,代码行数:31,代码来源:vue-i18n-tests.ts

示例9: createPersistedState

import institution from "./modules/institution";
import search from "./modules/search";
import transcript from "./modules/transcript";

const modules = {
  authentication,
  calendar,
  filter,
  institution,
  search,
  transcript
};

const PRODUCTION = process.env.NODE_ENV === "production";

Vue.use(Vuex);

const plugins = [
  createPersistedState({
    paths: Object.keys(modules).filter(m => m != "institution")
  })
];

if (PRODUCTION) {
  LogRocket.init("e5pnvu/can-i-graduate");
  plugins.push(
    createLogRocket(LogRocket, mutation => {
      if (mutation.type == "authentication/update") {
        return {
          type: mutation.type,
          payload: {
开发者ID:kevmo314,项目名称:canigraduate.uchicago.edu,代码行数:31,代码来源:index.ts

示例10: Vue

import './css/site.css';
import 'bootstrap';
import Vue from 'vue';
import VueRouter from 'vue-router';
Vue.use(VueRouter);

const routes = [
    { path: '/', component: require('./components/home/home.vue.html') },
    { path: '/work', component: require('./components/work/work.vue.html') },
    { path: '/aboutme', component: require('./components/aboutme/aboutme.vue.html') }
];

new Vue({
    el: '#app-root',
    router: new VueRouter({ mode: 'history', routes: routes }),
    render: h => h(require('./components/app/app.vue.html'))
});
开发者ID:sunnycase,项目名称:MoeAtHomeWeb,代码行数:17,代码来源:boot.ts


注:本文中的vue.use函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。