use-tool
v1.0.3
Published
```js src config router.js store.js views home.vue main.js vite.config.js ```
Downloads
2
Readme
##1.src下新建目录config
src
config
router.js
store.js
views
home.vue
main.js
vite.config.js
##main.js
import { createApp } from 'vue'
import App from './App.vue'
import store from "./config/store";
import router from "./config/router";
import useTool from "./useTool";
createApp(App).use(useTool,{store,router}).mount('#app')
router.js
import Home from '@/views/home'
export default [
{
path: '/',
component: Home
},
// {
// path: '/about',
// component: ()=> import('@/views/about')
// },
]
store.js
export default {
state () {
return {
count: 0
}
},
mutations: {
increment (state) {
state.count++
},
}
}
vite.config.js
import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import {resolve} from 'path'
export default defineConfig({
plugins: [
vue(),
],
resolve: {
extensions: ['.js', '.vue', '.json','.mjs'],
alias: {
'@': resolve(__dirname, 'src')
}
},
css: {
// 使用 scss
// preprocessorOptions: {
// scss: {}
// }
},
server: {
proxy: {
// '/api': {
// target: 'http://jsonplaceholder.typicode.com',
// changeOrigin: true,
// rewrite: (path) => path.replace(/^\/api/, '')
// }
}
}
})
home.vue
<template>
</template>
<script setup>
console.log($this);
</script>
<style scoped lang="scss">
</style>