Giter Club home page Giter Club logo

Comments (4)

baiwusanyu-c avatar baiwusanyu-c commented on May 30, 2024

In the case you provided, I did not find that ce-ui-core.js was used in the playground, so I don’t know how you used it specifically, but I noticed that you used createCEApp incorrectly.
I made changes to the files in the package directory, and the alert component can be rendered.

// index.ts
import { createCEApp } from '@unplugin-vue-ce/ce-app'
import './style.css'
import Alert from '@components/Alert'

const ClgAlert = createCEApp(Alert.AlertBase)

// export individual elements
export { ClgAlert }

export function register() {
  ClgAlert.mount('clg-alert')
}
register()
// index.html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/svg+xml" href="/vite.svg" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Vite + Vue + TS</title>
  </head>
  <body>
    <div id="app">
        <clg-alert></clg-alert>
    </div>
    <script type="module" src="/src/index.ts"></script>
  </body>
</html>

from unplugin-vue-ce.

mrcego avatar mrcego commented on May 30, 2024

I just built package repo using pnpm build and then pnpm i to do it part as project dependency, and tried to use in index.html file of playground monorepo. My idea was the same as your example, exposing and using register() in playground monorepo directly.

from unplugin-vue-ce.

baiwusanyu-c avatar baiwusanyu-c commented on May 30, 2024

The warning message about Component is missing template or render function is because you exported an object, so you need to make sure to pass in a specific component object.
const ClgAlert = createCEApp(Alert.AlertBase)

from unplugin-vue-ce.

mrcego avatar mrcego commented on May 30, 2024

Look like it's correct now, I missed miserably that detail 😊. In the other hand, I just ran in issue with slots, but this is another story. Thanks again @baiwusanyu-c.

from unplugin-vue-ce.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.