mirror of
https://gitee.com/ssssssss-team/magic-boot.git
synced 2025-01-19 03:52:50 +08:00
build 正常使用
This commit is contained in:
parent
d007875a43
commit
4bcd0cfc3b
@ -1,3 +1,3 @@
|
||||
ENV = 'production'
|
||||
VITE_APP_BASE_API = 'http://xxx:8081/'
|
||||
VITE_APP_BASE_API = 'http://localhost:8081/'
|
||||
|
||||
|
@ -5,8 +5,12 @@
|
||||
</el-row>
|
||||
<mb-table ref="magicTable" v-bind="tableOptions">
|
||||
<template v-for="col in cols" #[col.field]="{ index }">
|
||||
<div v-if="!col.component">
|
||||
{{ tableOptions.data[index][col.field] }}
|
||||
</div>
|
||||
<component
|
||||
:is="!col.component ? 'mb-input' : col.component.startsWith('el-') ? col.component : 'mb-' + col.component"
|
||||
v-else
|
||||
:is="col.component.startsWith('el-') ? col.component : 'mb-' + col.component"
|
||||
v-model="tableOptions.data[index][col.field]"
|
||||
v-bind="col.props"
|
||||
@change="dataChange"
|
||||
@ -65,6 +69,7 @@ tableOptions.cols.push({
|
||||
})
|
||||
|
||||
watch(() => props.modelValue, (value) => {
|
||||
console.log(value)
|
||||
tableOptions.data = value
|
||||
}, {
|
||||
deep: true
|
||||
|
@ -72,29 +72,29 @@ common.renderWhere = (where) => {
|
||||
return newWhere
|
||||
}
|
||||
|
||||
common.exportExcel = (options) => {
|
||||
var where = options.where || {}
|
||||
where = common.renderWhere(where)
|
||||
where.current = 1
|
||||
where.size = 99999999
|
||||
const url = options.url
|
||||
const headers = options.headers
|
||||
const columns = options.columns
|
||||
request({
|
||||
url: url,
|
||||
method: 'post',
|
||||
params: where
|
||||
}).then(res => {
|
||||
import('@/vendor/Export2Excel').then(excel => {
|
||||
const data = formatJson(res.data, columns)
|
||||
excel.export_json_to_excel({
|
||||
header: headers,
|
||||
data,
|
||||
filename: 'table-list'
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
// common.exportExcel = (options) => {
|
||||
// var where = options.where || {}
|
||||
// where = common.renderWhere(where)
|
||||
// where.current = 1
|
||||
// where.size = 99999999
|
||||
// const url = options.url
|
||||
// const headers = options.headers
|
||||
// const columns = options.columns
|
||||
// request({
|
||||
// url: url,
|
||||
// method: 'post',
|
||||
// params: where
|
||||
// }).then(res => {
|
||||
// import('@/vendor/Export2Excel').then(excel => {
|
||||
// const data = formatJson(res.data, columns)
|
||||
// excel.export_json_to_excel({
|
||||
// header: headers,
|
||||
// data,
|
||||
// filename: 'table-list'
|
||||
// })
|
||||
// })
|
||||
// })
|
||||
// }
|
||||
|
||||
common.handlerTreeData = (data, id, pid, sort, pidVal) => {
|
||||
var treeData = []
|
||||
|
@ -1,6 +1,8 @@
|
||||
import request from '@/scripts/request'
|
||||
import common from '@/scripts/common'
|
||||
import { defineAsyncComponent } from 'vue'
|
||||
|
||||
const viewModules = import.meta.glob("../views/**/**.vue")
|
||||
const layoutModules = import.meta.glob("../layout/**.vue")
|
||||
|
||||
export const filterAsyncRouter = (routers, level) => {
|
||||
level = level || 0
|
||||
@ -13,7 +15,7 @@ export const filterAsyncRouter = (routers, level) => {
|
||||
const component = router.component
|
||||
if (component === 'Layout') {
|
||||
router.path = "/" + common.uuid()
|
||||
router.component = level > 0 ? import(`../layout/none.vue`) : loadLayoutView(component)
|
||||
router.component = level > 0 ? layoutModules[`../layout/none.vue`] : loadLayoutView(component)
|
||||
} else {
|
||||
router.path = router.path = router.path.startsWith('/') ? router.path : '/' + router.path
|
||||
router.component = loadView(component)
|
||||
@ -30,12 +32,12 @@ export const filterAsyncRouter = (routers, level) => {
|
||||
}
|
||||
|
||||
export const loadLayoutView = (view) => {
|
||||
return import(`../layout/layout.vue`)
|
||||
return layoutModules[`../layout/layout.vue`]
|
||||
}
|
||||
|
||||
export const loadView = (view) => {
|
||||
view = view.substring(0, 1) === '/' ? view : '/' + view
|
||||
return defineAsyncComponent(() => import(`../views${view}.vue`))
|
||||
return viewModules[`../views${view}.vue`]
|
||||
}
|
||||
|
||||
export function generateRoutes(){
|
||||
|
@ -1,31 +0,0 @@
|
||||
<template>
|
||||
<div class="dashboard-container">
|
||||
<div class="dashboard-text">欢迎</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'Dashboard',
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'name'
|
||||
])
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.dashboard {
|
||||
&-container {
|
||||
margin: 30px;
|
||||
background: white;
|
||||
}
|
||||
&-text {
|
||||
font-size: 30px;
|
||||
line-height: 46px;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -5,17 +5,34 @@ import viteSvgIcons from 'vite-plugin-svg-icons'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
vue(),
|
||||
viteSvgIcons({
|
||||
iconDirs: [path.resolve(process.cwd(), 'src/icons')],
|
||||
symbolId: 'mb-icon-[name]'
|
||||
})
|
||||
],
|
||||
resolve: {
|
||||
base: './',
|
||||
plugins: [
|
||||
vue(),
|
||||
viteSvgIcons({
|
||||
iconDirs: [path.resolve(process.cwd(), 'src/icons')],
|
||||
symbolId: 'mb-icon-[name]'
|
||||
})
|
||||
],
|
||||
resolve: {
|
||||
extensions: ['.vue', '.json', '.js'],
|
||||
alias: {
|
||||
'@': path.resolve(__dirname,'src')
|
||||
alias: {
|
||||
'@': path.resolve(__dirname,'src')
|
||||
}
|
||||
},
|
||||
css: {//去除@charset UTF-8规则影响
|
||||
postcss: {
|
||||
plugins: [
|
||||
{
|
||||
postcssPlugin: 'internal:charset-removal',
|
||||
AtRule: {
|
||||
charset: (atRule) => {
|
||||
if (atRule.name === 'charset') {
|
||||
atRule.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user