Commit 5a1c4fd3 authored by 郭志伟's avatar 郭志伟

chore(ui): 调试

parent 5bd5f04a
......@@ -17,7 +17,7 @@
</div>
</template>
<script>
import FormList from '../mixins/formList.mixin.js';
import FormList from '../mixins/formList.mixin.ts';
import { SHOP_CART_CONFIG, SHARE_CONFIG, DEFAULT_CONFIG } from '@service/staticData.service';
const CONFIG_MAP = {
......
......@@ -17,7 +17,7 @@
</div>
</template>
<script>
import FormList from '../mixins/formList.mixin.js';
import FormList from '../mixins/formList.mixin.ts';
export default {
mixins: [FormList]
}
......
import {Component, Prop, Watch, Vue } from 'vue-property-decorator';
import ComponentSelect from '../ComponentSelect/index.vue';
import Upload from '../Upload/index.vue';
import ColorSelector from '../ColorSelector/index.vue';
import SwitchBtn from '../SwitchBtn/index.vue';
import BaseSelect from '../BaseSelect/index.vue';
@Component({ name: 'formListMixin', components: { ComponentSelect, Upload, ColorSelector, SwitchBtn, BaseSelect } })
export default class DynamicFormMixin extends Vue {
@Prop({ type: Array, default: () => [] }) value;
@Prop({ type: Array, default: () => [] }) formControl;
@Prop({ type: Object, default: () => [] }) formDefault;
@Prop(String) name;
list: object[] = [];
@Watch('list')
onListChange(val) {
this.$emit('input', val);
}
@Watch('value', { immediate: true })
onValueChange(val) {
this.list = val;
}
getComponent(type) {
let result = type;
switch (type) {
case 'text':
result = 'Input';
break;
case 'select':
result = 'BaseSelect';
break;
case 'checkbox':
result = 'Checkbox';
break;
case 'textarea':
result = 'Textarea';
break;
case 'number' :
result = 'Number';
break;
case 'switch':
result = 'SwitchBtn';
break;
}
return result;
}
add() {
const object = this.formControl.reduce((pre, cur) => {
pre[cur.key] = this.formDefault[cur.key] || '';
return pre;
}, {});
this.list.push(object);
}
del(index) {
this.list.splice(index, 1);
}
}
\ No newline at end of file
......@@ -91,7 +91,7 @@ export const defaultState = {
{
persets: '购物车',
icon: 'shopping-cart-o',
url: 'xyqb://shoppingCartTab',
url: 'xyqb://shoppingCart?needLogin=1',
color: '#333',
iconColor: '#333',
background: '#fff',
......
......@@ -3,7 +3,7 @@ export const SHOP_CART_CONFIG = {
persets: '购物车',
txt: '',
icon: 'shopping-cart-o',
url: 'xyqb://shoppingCartTab',
url: 'xyqb://shoppingCart?needLogin=1',
color: '#333',
iconColor: '#333',
background: '#fff',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment