Skip to content

Commit

Permalink
feat(vue2-iview3): 适配 iview3
Browse files Browse the repository at this point in the history
re #27
  • Loading branch information
lljj-x committed Jan 18, 2021
1 parent f03352e commit 0120d2b
Show file tree
Hide file tree
Showing 29 changed files with 101 additions and 275 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ stats.html

packages/lib/vue2-form-element/stats.html
/packages/docs/docs/.vuepress/dist/
/packages/demo/dist
/packages/demo/demo-v2/dist
/packages/demo/demo-v3/dist

# local env files
.env.local
Expand Down
18 changes: 18 additions & 0 deletions packages/demo/demo-v2/src/pages/index/views/Demo/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
placeholder="ui"
size="mini"
style="margin-left: 10px;width: 130px;"
@change="handleUiChange"
>
<el-option
v-for="item in formComponents"
Expand Down Expand Up @@ -291,6 +292,23 @@ export default {
this.initData();
},
methods: {
handleUiChange(value) {
const formatStr = jsonCode => JSON.stringify(JSON.parse(jsonCode));
this.$router.replace({
query: {
...this.$route.query,
ui: value,
schema: formatStr(this.curSchemaCode),
formData: formatStr(this.curFormDataCode),
uiSchema: formatStr(this.curUiSchemaCode),
errorSchema: formatStr(this.curErrorSchemaCode),
formFooter: formatStr(JSON.stringify(this.trueFormFooter)),
formProps: formatStr(JSON.stringify(this.trueFormProps)),
}
});
window.location.reload();
},
sliderFormat(value) {
return value ? `${value * 4}px` : undefined;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
* Created by Liu.Jun on 2020/10/24 9:21 下午.
*/

import '@/_common/bootstrap.js';
import 'demo-common/bootstrap.js';

import Vue from 'vue';
import elementUI from '@/_common/components/ElementUi/index.js';
import elementUI from 'demo-common/components/ElementUi/index.js';
import router from './router';
import App from './App';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@

<script>
import VueJsonFrom from '@lljj/vue-json-schema-form';
import componentWithDialog from '@/_common/components/component-with-dialog';
import { openNewPage } from '@/_common/utils/url.js';
import componentWithDialog from 'demo-common/components/component-with-dialog';
import { openNewPage } from 'demo-common/utils/url.js';
import EditorHeader from '@/_common/components/EditorHeader.vue';
import EditorHeader from 'demo-common/components/EditorHeader.vue';
import FormConfSchema from './viewComponents/FormConf';
import EditorToolBar from './EditorToolBar.vue';
import ExportSchemaView from './components/ExportSchemaView.vue';
Expand All @@ -150,8 +150,6 @@ import { deepFreeze } from './common/utils';
import configTools from './config/tools';
import './common/registerExtraElementComponent';
import NestedEditor from './components/NestedEditor';
import { componentList2JsonSchema, formatFormLabelWidth } from './common/editorData';
import jsonSchema2ComponentList from './common/jsonSchema2ComponentList';
Expand Down Expand Up @@ -363,7 +361,7 @@ export default {
}
</style>
<style module>
@import 'variable.css';
@import 'demo-common/css/variable.css';
:root {
--site-top-height: 80px;
--tool-bar-width: 260px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default {
</script>

<style module>
@import "variable.css";
@import "demo-common/css/variable.css";
.box{
padding: 10px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import { getDefaultFormState } from '@lljj/vue-json-schema-form';
import { genId } from '@/_common/utils/id';
import { genId } from 'demo-common/utils/id';
import { isObject, isEmptyObject } from './utils';

// 生成一个新的editor item
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Created by Liu.Jun on 2019/11/28 18:37.
*/

// import { genId } from '@/_common/utils/id';
// import { genId } from 'demo-common/utils/id';

export function isObject(obj) {
return (Object.prototype.toString.call(obj) === '[object Object]');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</template>

<script>
import JsonPrettyPrint from '@/_common/components/JsonPerttyPrint.vue';
import JsonPrettyPrint from 'demo-common/components/JsonPerttyPrint.vue';
export default {
name: 'ExportSchemaView',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

<script>
import Draggable from 'vuedraggable';
import * as arrayMethods from '@/_common/utils/array';
import * as arrayMethods from 'demo-common/utils/array';
import { generateEditorItem } from '../common/editorData';
// 避免循环依赖导致undefined
Expand Down Expand Up @@ -125,7 +125,7 @@ export default {
</script>

<style module>
@import 'variable.css';
@import 'demo-common/css/variable.css';
:global {
.ghostItem {
opacity: 0.6;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
</template>

<script>
import { SchemaField } from '@lljj/vue-json-schema-form';
import emitter from '@/pages/schema-generator/mixins/emitter.js';
import { SchemaField, globalOptions } from '@lljj/vue-json-schema-form';
import emitter from '../../../mixins/emitter.js';
import NestedEditor from './NestedEditor';
import { editorItem2SchemaFieldProps } from '../common/editorData';
Expand Down Expand Up @@ -100,6 +100,7 @@ export default {
attrs() {
return {
formProps: this.formProps,
globalOptions,
...editorItem2SchemaFieldProps(this.editorItem, this.formData)
};
}
Expand Down Expand Up @@ -157,7 +158,7 @@ export default {
</script>

<style module>
@import "variable.css";
@import "demo-common/css/variable.css";
.viewBox {
position: relative;
margin-bottom: 10px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "variable.css";
@import "demo-common/css/variable.css";

:root {
--color-skeleton-bg: var(--background-color-base);
Expand Down
Loading

0 comments on commit 0120d2b

Please sign in to comment.