12345678910111213141516171819202122232425262728293031323334353637383940 |
- import Vue from 'vue'
- import App from './App.vue'
- import router from './router'
- import ElementUI from 'element-ui';
- import 'element-ui/lib/theme-chalk/index.css';
- import lang from './tools/lang';
- import ajax from './tools/ajax';
- Vue.use(ElementUI);
- Vue.config.productionTip = false;
- // 多语言支持
- Vue.prototype.$lang = moduleName => {
- let type = localStorage.getItem('lang') || 'zht';
- return lang[type][moduleName];
- }
- // 复制分享链接
- Vue.prototype.$copy = (id, title) => {
- let user = JSON.parse(localStorage.getItem('designer_user')).user_name;
- let input = document.createElement('textarea');
- input.value = `${user}为您分享了一个项目,快来看看吧!\n项目地址:http://designer.xuxiangbo.com/${id}\n项目名称: ${title}`;
- document.body.append(input);
- input.select();
- document.execCommand('copy');
- input.remove();
- ElementUI.Message({
- type: 'success',
- message: '已复制项目链接!'
- })
- }
- // ajax
- Vue.prototype.$ajax = ajax;
- new Vue({
- router,
- render: function (h) { return h(App) }
- }).$mount('#app')
|