-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
64 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
import { createApp } from 'vue' | ||
import { createApp,defineCustomElement } from 'vue' | ||
import ElementPlus from 'element-plus' // 导入UI组件库 | ||
import 'element-plus/dist/index.css' // 导入依赖css文件 | ||
import App from './App.vue' | ||
import hello from './components/hello/hello.ce.vue' | ||
const app = createApp(App) | ||
app.use(ElementPlus) // 全局安装ElementPlus | ||
app.mount('#app') | ||
import MyCount from "./components/hello/hello.ce.vue"; // 引入计数器组件 | ||
|
||
const CustomElement = defineCustomElement(MyCount); | ||
|
||
// 为了便于业务自定义标签名称,导出名称注册方法,默认为my-conut | ||
export function register(tagName = "my-count") { | ||
customElements.define(tagName, CustomElement); | ||
return CustomElement; | ||
} |