添加全局样式和 element ui框架
This commit is contained in:
@@ -1,25 +1,22 @@
|
||||
// import './assets/main.css'
|
||||
import { createApp } from 'vue'
|
||||
import { createPinia } from 'pinia'
|
||||
import App from './App'
|
||||
import router from './router'
|
||||
import { init } from "shared/normalize";
|
||||
import element from "shared/element-plus";
|
||||
|
||||
// import { getNacosInstance } from '@shared/lib/nacosInstance';
|
||||
|
||||
class Main {
|
||||
constructor() {
|
||||
createApp(App)
|
||||
.use(createPinia())
|
||||
.use(router)
|
||||
.mount('#app')
|
||||
const app = createApp(App)
|
||||
|
||||
// this.test()
|
||||
}
|
||||
app.use(createPinia())
|
||||
.use(router)
|
||||
.mount('#app')
|
||||
|
||||
async test() {
|
||||
// 关键:通过getNacosInstance获取实例(确保已初始化)
|
||||
const nacos = await getNacosInstance();
|
||||
console.log("product: ", await nacos.find('app-product'))
|
||||
app.use(element)
|
||||
|
||||
init()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Component, Ref, Setup, Vue } from 'vue-facing-decorator'
|
||||
import Header from '../components/Header'
|
||||
import { RouteLocationNormalizedLoaded, Router, useRoute, useRouter } from "vue-router";
|
||||
import { ElButton, SearchIcon } from "shared/element-plus";
|
||||
|
||||
interface ListItemType {
|
||||
id: number
|
||||
@@ -49,6 +50,7 @@ export default class Home extends Vue {
|
||||
return (
|
||||
<div class="home">
|
||||
<h1 ref="refH1">首页</h1>
|
||||
<ElButton type="primary" icon={ SearchIcon }>按钮</ElButton>
|
||||
<p onClick={ this.addCount }>counter 响应式变量(点我):{ this.counter }</p>
|
||||
<Header
|
||||
list={ this.newList }
|
||||
|
||||
@@ -10,9 +10,11 @@ declare module 'product/ProductDomain' {
|
||||
stock: number;
|
||||
categoryId: number;
|
||||
}
|
||||
// 应用服务类型
|
||||
|
||||
// 应用服务类型
|
||||
export class ProductApplicationService {
|
||||
constructor(repo: ProductRepository);
|
||||
|
||||
findAll(): Promise<Array<any>>; // TODO any 需要修改
|
||||
findById(id: number): Promise<Product>
|
||||
}
|
||||
@@ -39,6 +41,4 @@ declare module 'product/ProductRouter' {
|
||||
export const productRouter: RouteRecordRaw[];
|
||||
}
|
||||
|
||||
declare module 'shared/utils' {
|
||||
export const UrlCheckUtils: any;
|
||||
}
|
||||
|
||||
20
front-end/main-app/src/shared/types/shared.d.ts
vendored
Normal file
20
front-end/main-app/src/shared/types/shared.d.ts
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
declare module 'shared/utils' {
|
||||
export const UrlCheckUtils: any;
|
||||
}
|
||||
|
||||
declare module 'shared/element-plus' {
|
||||
import { App } from "vue";
|
||||
export {
|
||||
ElButton,
|
||||
ElInput,
|
||||
ElTable,
|
||||
ElMessage
|
||||
// 添加其他组件
|
||||
} from 'element-plus';
|
||||
export const initElement: (app: App) => void;
|
||||
export default any;
|
||||
}
|
||||
|
||||
declare module 'shared/normalize' {
|
||||
export const init: () => void;
|
||||
}
|
||||
Reference in New Issue
Block a user