51 lines
1.1 KiB
JavaScript
51 lines
1.1 KiB
JavaScript
![]() |
import {createApp} from 'vue';
|
||
|
import vant from 'vant';
|
||
|
import 'vant/lib/index.css';
|
||
|
import formCreate from '@form-create/ant-design-vue';
|
||
|
import App from './App.vue';
|
||
|
import FcDesigner from '../src/index';
|
||
|
import Antd from 'ant-design-vue';
|
||
|
import 'ant-design-vue/dist/reset.css';
|
||
|
|
||
|
const app = createApp(App);
|
||
|
|
||
|
app.use(Antd);
|
||
|
app.use(vant);
|
||
|
app.use(formCreate);
|
||
|
app.use(FcDesigner);
|
||
|
FcDesigner.setFormula([
|
||
|
{
|
||
|
menu: 'math',
|
||
|
name: 'test',
|
||
|
info: '扩展自定义计算函数示例',
|
||
|
example: 'test(val) == !!val',
|
||
|
handle(val) {
|
||
|
return !!val
|
||
|
}
|
||
|
}
|
||
|
])
|
||
|
|
||
|
FcDesigner.setBehavior([
|
||
|
{
|
||
|
menu: 'other',
|
||
|
name: 'test',
|
||
|
label: '扩展自定义行为',
|
||
|
info: '扩展自定义行为示例',
|
||
|
rule() {
|
||
|
return [
|
||
|
{
|
||
|
type: 'input',
|
||
|
field: 'custom',
|
||
|
title: '自定义配置'
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
handle(config) {
|
||
|
console.log(config)
|
||
|
}
|
||
|
}
|
||
|
])
|
||
|
|
||
|
|
||
|
app.mount('#app')
|