form-create icon indicating copy to clipboard operation
form-create copied to clipboard

vue3 element-plus 全局方法 window.formCreate.create

Open chiyandetaotie opened this issue 2 years ago • 1 comments

@form-create/element-ui 版本: 3.1.26 element-plus 版本: 2.4.1

您好,我参看实例,使用 全局方法(https://form-create.com/v3/guide/start) `//表单插入的节点 const root = document.getElementById('form-create')

const fApi = window.formCreate.create( //表单生成规则 [ { type: 'input', field: 'goods_name', title: '商品名称' }, { type: 'datePicker', field: 'created_at', title: '创建时间' } ], //组件参数配置 { el: root, //显示表单重置按钮 resetBtn: true, //表单提交事件 onSubmit: function (formData) { //按钮进入提交状态 fApi.btn.loading() } })`

报错,如下: form-create.esm.js?da05:5787 Uncaught (in promise) TypeError: Cannot read property 'fapi' of undefined at create (form-create.esm.js?da05:5787) at Proxy.mounted (job_submit_original_test_001.vue?577e:81) at callWithErrorHandling (runtime-core.esm-bundler.js?5c40:155) at callWithAsyncErrorHandling (runtime-core.esm-bundler.js?5c40:164) at Array.hook.__weh.hook.__weh (runtime-core.esm-bundler.js?5c40:2687) at flushPostFlushCbs (runtime-core.esm-bundler.js?5c40:358) at flushJobs (runtime-core.esm-bundler.js?5c40:403)

runtime-core.esm-bundler.js?5c40:38 [Vue warn]: Failed to resolve component: elRow If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement. at <FormCreate ref="fc" rule= (2) [{…}, {…}] option= {el: div#form-create, resetBtn: true, onSubmit: ƒ} > at <App>

请问,全局方法如何正确使用?

chiyandetaotie avatar Dec 12 '23 07:12 chiyandetaotie

所需要的组件没有挂载, 把elementPlus全局挂载

xaboy avatar Jan 02 '24 11:01 xaboy