vite.config.js
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from "path"
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
"@": path.resolve(__dirname, "/src"),
"~@": path.resolve(__dirname, "/src"),
},
},
})
测试:
<template>
<div class="test">
test
</div>
</template>
<script setup>
</script>
<style lang="less" scoped>
.test {
width: 100%;
height: 100%;
background-image: url('@/assets/positions.jpeg');
}
</style>
网友评论