@unplugin-vue-ce/ce-app

23,027 75
Install
npm install @unplugin-vue-ce/ce-app
Latest Version:1.0.0
Vue:3
License:MIT
Last Updated:Sep 5, 2024
Links: GitHub  ·  npm
Maintainer: baiwusanyu

@unplugin-vue-ce/ce-app

The implementation principle of @unplugin-vue-ce/ce-app comes from vue-web-component-wrapper

Tips: @unplugin-vue-ce/ce-app Seamlessly integrates with Vue ecosystem plugins such as Vuex, Vue Router, and Vue I18n.

Snapshot

ce-app.gif

Install

npm i @unplugin-vue-ce/ce-app

or

yarn add @unplugin-vue-ce/ce-app

or

pnpm add @unplugin-vue-ce/ce-app

Usage

// main.ts
import { defineCustomElement} from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import Entry from './Entry.vue'
import router from './router'
import { createCEApp } from "@unplugin-vue-ce/ce-app";
const app = createCEApp(App)
// use plugin
app.use(createPinia())
app.use(router)
// provide & inject
app.provide('message', 'hello')
// vue-app is web component name
app.mount('vue-app')

const ceEntry = defineCustomElement(Entry)
customElements.define('ce-entry', ceEntry)

<!-- App.vue -->
<template>
  <ce-entry></ce-entry>
</template>

<!-- index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="icon" href="/favicon.ico">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vite App</title>
</head>
<body>
<div id="app">
    <vue-app></vue-app>
</div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>

Related Packages

@unplugin-vue-ce/sub-style

A vue plugin that extends vue's Custom Element capabilities (sub component style...

39,165 75
unplugin-vue-ce

A vue plugin that extends vue's Custom Element capabilities (v-model, child styl...

24,311 75
@unplugin-vue-ce/v-model

A vue plugin that extends vue's Custom Element capabilities (v-model)

22,716 75
@unplugin-vue-ce/switch-shadow

A vue plugin that extends vue's Custom Element capabilities (free switch shadow)

22,451 75

Version History

Version Released Vue License
1.0.0 ^3.3.2 MIT
Pre-releases (17)
Version Released Vue License
1.0.0-beta.21 ^3.3.2 MIT
1.0.0-beta.20 ^3.3.2 MIT
1.0.0-beta.19 ^3.3.2 MIT
1.0.0-beta.18 ^3.3.2 MIT
1.0.0-beta.17 ^3.3.2 MIT