archy/neode-ui/src/main.ts

41 lines
1.1 KiB
TypeScript
Raw Normal View History

2026-01-24 22:59:20 +00:00
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import './style.css'
import App from './App.vue'
import router from './router'
import i18n from './i18n'
// Clipboard polyfill for HTTP (non-secure) contexts where navigator.clipboard is unavailable
if (!navigator.clipboard) {
Object.defineProperty(navigator, 'clipboard', {
value: {
async writeText(text: string) {
const ta = document.createElement('textarea')
ta.value = text
ta.style.cssText = 'position:fixed;opacity:0'
document.body.appendChild(ta)
ta.select()
document.execCommand('copy')
document.body.removeChild(ta)
},
async readText() { return '' },
},
})
}
import { useToast } from '@/composables/useToast'
2026-01-24 22:59:20 +00:00
const app = createApp(App)
const pinia = createPinia()
app.use(pinia)
app.use(router)
app.use(i18n)
2026-01-24 22:59:20 +00:00
app.config.errorHandler = (err, _instance, info) => {
console.error('[Vue Error]', err, info)
const { error } = useToast()
error('Something went wrong. Please refresh the page.')
}
2026-01-24 22:59:20 +00:00
app.mount('#app')