diff --git a/packages/web/src/components/index.ts b/packages/web/src/components/index.ts index 32ecda53..c148ebf2 100644 --- a/packages/web/src/components/index.ts +++ b/packages/web/src/components/index.ts @@ -4,7 +4,7 @@ import Category from './Category/index.vue'; import Tabs from './Tabs/index.vue'; import RuleEmpty from './RuleEmpty/index.vue'; -export function useComponent(app: App) { +export default function useComponent(app: App) { app.component('ARCover', Cover); app.component('ARCategory', Category); app.component('ARTabs', Tabs); diff --git a/packages/web/src/directive/index.ts b/packages/web/src/directive/index.ts new file mode 100644 index 00000000..fc91476e --- /dev/null +++ b/packages/web/src/directive/index.ts @@ -0,0 +1,7 @@ +import type { App } from 'vue'; + +export default function useDirective(app: App) { + app.directive('focus', { + mounted: (el) => el.focus() + }); +} diff --git a/packages/web/src/main.ts b/packages/web/src/main.ts index 3da36442..ea32bba1 100644 --- a/packages/web/src/main.ts +++ b/packages/web/src/main.ts @@ -1,7 +1,8 @@ import { createApp } from 'vue'; import App from './App.vue'; import router from './router'; -import { useComponent } from './components'; +import useComponent from './components'; +import useDirective from './directive'; import './assets'; import './plugins/vsc-ui'; import './plugins/antd'; @@ -17,6 +18,7 @@ const app = createApp(App); app.use(router); app.use(createPinia()); useComponent(app); +useDirective(app); router.beforeEach((to, _from, next) => { const { query, path } = to; diff --git a/packages/web/src/pages/pc/content/index.vue b/packages/web/src/pages/pc/content/index.vue index b365341b..9208671b 100644 --- a/packages/web/src/pages/pc/content/index.vue +++ b/packages/web/src/pages/pc/content/index.vue @@ -11,7 +11,7 @@ -
+