index.js 2.6 KB
Newer Older
L
ligang 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'
import i18n from '@/module/i18n'
import { sync } from 'vuex-router-sync'
26
import Chart from '@/module/ana-charts'
G
gongzijian 已提交
27
import '@/module/filter/formatDate'
L
ligang 已提交
28 29
import themeData from '@/module/echarts/themeData.json'
import Permissions from '@/module/permissions'
B
break60 已提交
30 31 32
import 'ans-ui/lib/ans-ui.min.css'
import ans from 'ans-ui/lib/ans-ui.min'
import en_US from 'ans-ui/lib/locale/en' // eslint-disable-line
L
ligang 已提交
33
import 'sass/conf/home/index.scss'
34
import 'bootstrap/dist/css/bootstrap.min.css'
35

36
import 'bootstrap/dist/js/bootstrap.min.js'
37
import 'canvg/dist/browser/canvg.min.js'
L
ligang 已提交
38 39

// Component internationalization
40
const useOpt = i18n.globalScope.LOCALE === 'en_US' ? { locale: en_US } : {}
L
ligang 已提交
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74

// Vue.use(ans)
Vue.use(ans, useOpt)

sync(store, router)

Vue.config.devtools = true
Vue.config.productionTip = true
Vue.config.silent = true

Chart.config({
  theme: {
    name: 'themeName',
    data: themeData,
    default: true
  }
})

/* eslint-disable no-new */
Permissions.request().then(res => {
  // instance
  new Vue({
    el: '#app',
    router,
    store,
    render: h => h(App),
    mounted () {
      document.addEventListener('click', (e) => {
        $('#contextmenu').css('visibility', 'hidden')
      })
    },
    methods: {
      initApp () {
        $('.global-loading').hide()
75
        const bootstrapTooltip = $.fn.tooltip.noConflict()
L
ligang 已提交
76 77 78 79 80 81 82 83 84 85 86 87 88 89
        $.fn.tooltip = bootstrapTooltip
        $('body').tooltip({
          selector: '[data-toggle="tooltip"]',
          trigger: 'hover'
        })
        // init
        i18n.init()
      }
    },
    created () {
      this.initApp()
    }
  })
})