Open shang1219178163 opened 2 years ago
3.2.0
github.com
console.log:
VToast instance Proxy {_: {…}, __v_skip: true}
//vue-cli-service serve --mode production
VToast instance:VueInstance
VToast instance:Proxy
src/components/VToast/index.js
import { createApp, nextTick, ref, h } from "vue"; import VToast from "./VToast.vue"; export default { install: (app, options) => { nextTick(() => { /* Vue3的自定义插件 */ // 1.实例化并绑定组件 const constructor = createApp(VToast); const container = document.createElement('div'); const instance = constructor.mount(container); // 2.将挂载的Node添加到body中 document.body.appendChild(instance.$el); // 3.定义全局($toast即是此插件的名称) app.config.globalProperties.$vtoast = instance; console.log('VToast instance:', instance); }) }, };
vue-cli-service serve is OK!
vue-cli-service serve --mode production: error
"vue": "^3.2.0", "@vue/cli-plugin-babel": "~4.5.0", "@vue/cli-plugin-eslint": "~4.5.0", "@vue/cli-service": "~4.5.0", "@vue/compiler-sfc": "^3.0.0",
I think you can show this problem with sfc.
I can't reproduce this issue at sfc because of a project structure issue. sorry!
Version
3.2.0
Reproduction link
github.com
Steps to reproduce
console.log:
VToast instance Proxy {_: {…}, __v_skip: true}
What is expected?
//vue-cli-service serve --mode production
VToast instance:VueInstance
What is actually happening?
//vue-cli-service serve --mode production
VToast instance:Proxy
src/components/VToast/index.js
vue-cli-service serve is OK!
vue-cli-service serve --mode production: error