當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。