Commit 605a9e1a authored by 郝聪敏's avatar 郝聪敏

fix: dots保存在组件内部

parent 92c63c3c
const mdData = require('@qg/cherry-ui/md/index.json');
// mdData.forEach(com => com.value = com.config.reduce((pre, cur) => {
// pre[cur.key] = cur.val;
// return pre;
// }, {}));
// console.log('basicComponents', mdData);
export const basicComponents = mdData;
// export const basicComponents = [
// {
// eleName: 'freedom-container',
// title: '自由容器',
// h: 300,
// config: [
// {
// key: 'backgroundImage',
// name: '背景图片',
// type: 'Upload'
// },
// ],
// value: {
// backgroundImage: 'http://activitystatic.q-gp.com/landing-bg.png';
// },
// commonStyle: {}
// },
// {
// h: 44,
// eleName: 'cr-button',
// title: 'Button 按钮',
// config: [
// {
// key: 'type',
// name: '类型',
// desc: '类型,可选值为',
// options: [
// 'default',
// 'primary',
// 'info',
// 'danger',
// 'waring',
// 'success'
// ],
// type: 'select'
// },
// {
// key: 'size',
// name: '尺寸',
// desc: '尺寸,可选值为',
// options: [
// 'normal',
// 'large',
// 'small',
// 'mini'
// ],
// type: 'select'
// },
// {
// key: 'color',
// name: '颜色',
// desc: '按钮颜色,支持传入',
// type: 'ColorSelector'
// },
// {
// key: 'icon',
// name: '图标',
// desc: '左侧',
// type: 'text'
// },
// {
// key: 'block',
// name: '块级元素',
// desc: '是否为块级元素',
// type: 'checkbox'
// },
// {
// key: 'shape',
// name: '形状',
// desc: '按钮形状,可选值为',
// options: [
// 'square',
// 'circle'
// ],
// type: 'select'
// },
// {
// key: 'disabled',
// name: '禁用',
// desc: '是否禁用按钮',
// type: 'checkbox'
// },
// {
// key: 'plain',
// name: '朴素按钮',
// desc: '朴素按钮',
// type: 'checkbox'
// },
// {
// key: 'hairline',
// name: '细边框',
// desc: '细边框',
// type: 'checkbox'
// },
// {
// key: 'loading',
// name: '加载中',
// desc: '是否显示为加载状态',
// type: 'checkbox'
// },
// {
// key: 'loadingText',
// name: '加载文字',
// desc: '加载状态提示文字',
// type: 'text'
// },
// {
// key: 'loadingType',
// name: '加载图标类型',
// desc: '',
// options: [
// 'circular',
// 'spinner'
// ],
// type: 'select'
// },
// {
// key: 'loadingSize',
// name: '加载图标大小',
// desc: '加载图标大小',
// type: 'text'
// }
// ],
// value: {
// type: 'default',
// size: 'normal',
// color: '',
// icon: '',
// block: false,
// shape: 'square',
// disabled: false,
// plain: false,
// hairline: false,
// loading: false,
// loadingText: '',
// loadingType: 'circular',
// loadingSize: '20px'
// },
// commonStyle: {}
// },
// {
// eleName: 'cr-image',
// title: '图片',
// h: 140,
// config: [
// {
// key: 'width',
// name: '宽度',
// type: 'text'
// },
// {
// key: 'height',
// name: '高度',
// type: 'text'
// },
// {
// key: 'src',
// name: '图片',
// type: 'Upload'
// },
// ],
// value: {
// width: '5.067rem',
// height: '3.733rem',
// src: 'https://appsync.lkbang.net/Fs0qmUsMry39AjHDf_W-qgn8XEy6',
// fit: 'contain',
// },
// commonStyle: {}
// },
// {
// eleName: 'cr-nav-bar',
// title: 'NavBar 导航栏',
// h: 48,
// config: [
// {
// key: 'title',
// name: '标题',
// desc: '标题',
// propType: 'string',
// options: [],
// type: 'text'
// },
// {
// key: 'leftText',
// name: '左侧文案',
// desc: '左侧文案',
// propType: 'string',
// options: [],
// type: 'text'
// },
// {
// key: 'rightText',
// name: '右侧文案',
// desc: '右侧文案',
// default: '',
// options: [
// 'info',
// 'danger',
// 'primary',
// 'warning'
// ],
// type: 'text'
// },
// {
// key: 'leftArrow',
// name: '左侧箭头',
// desc: '是否显示左侧箭头',
// propType: 'boolean',
// options: [],
// type: 'checkbox'
// },
// {
// key: 'border',
// name: '边框',
// desc: '是否显示下边框',
// propType: 'boolean',
// options: [],
// type: 'checkbox'
// },
// {
// key: 'fixed',
// name: '固定导航栏',
// desc: '是否固定导航栏',
// propType: 'boolean',
// options: [],
// type: 'checkbox'
// },
// {
// key: 'zIndex',
// name: 'z-index',
// desc: '元素z-index',
// propType: [
// 'number',
// 'string'
// ],
// options: [],
// type: 'text'
// }
// ],
// value: {
// title: '',
// leftText: '返回',
// rightText: '',
// leftArrow: true,
// border: true,
// fixed: true,
// zIndex: '9999'
// },
// commonStyle: {}
// }
// ];
// export const basicComponents = require('@qg/cherry-ui/md/index.json');
export const basicComponents = [
{
eleName: 'freedom-container',
title: '自由容器',
h: 300,
config: [
{
key: 'backgroundImage',
name: '背景图片',
type: 'Upload'
},
],
value: {
backgroundImage: 'http://activitystatic.q-gp.com/landing-bg.png';
},
commonStyle: {}
},
{
h: 44,
eleName: 'cr-button',
title: 'Button 按钮',
config: [
{
key: 'type',
name: '类型',
desc: '类型,可选值为',
options: [
'default',
'primary',
'info',
'danger',
'waring',
'success'
],
type: 'select'
},
{
key: 'size',
name: '尺寸',
desc: '尺寸,可选值为',
options: [
'normal',
'large',
'small',
'mini'
],
type: 'select'
},
{
key: 'color',
name: '颜色',
desc: '按钮颜色,支持传入',
type: 'ColorSelector'
},
{
key: 'icon',
name: '图标',
desc: '左侧',
type: 'text'
},
{
key: 'block',
name: '块级元素',
desc: '是否为块级元素',
type: 'checkbox'
},
{
key: 'shape',
name: '形状',
desc: '按钮形状,可选值为',
options: [
'square',
'circle'
],
type: 'select'
},
{
key: 'disabled',
name: '禁用',
desc: '是否禁用按钮',
type: 'checkbox'
},
{
key: 'plain',
name: '朴素按钮',
desc: '朴素按钮',
type: 'checkbox'
},
{
key: 'hairline',
name: '细边框',
desc: '细边框',
type: 'checkbox'
},
{
key: 'loading',
name: '加载中',
desc: '是否显示为加载状态',
type: 'checkbox'
},
{
key: 'loadingText',
name: '加载文字',
desc: '加载状态提示文字',
type: 'text'
},
{
key: 'loadingType',
name: '加载图标类型',
desc: '',
options: [
'circular',
'spinner'
],
type: 'select'
},
{
key: 'loadingSize',
name: '加载图标大小',
desc: '加载图标大小',
type: 'text'
}
],
value: {
type: 'default',
size: 'normal',
color: '',
icon: '',
block: false,
shape: 'square',
disabled: false,
plain: false,
hairline: false,
loading: false,
loadingText: '',
loadingType: 'circular',
loadingSize: '20px'
},
commonStyle: {}
},
{
eleName: 'cr-image',
title: '图片',
h: 140,
config: [
{
key: 'width',
name: '宽度',
type: 'text'
},
{
key: 'height',
name: '高度',
type: 'text'
},
{
key: 'src',
name: '图片',
type: 'Upload'
},
],
value: {
width: '5.067rem',
height: '3.733rem',
src: 'https://appsync.lkbang.net/Fs0qmUsMry39AjHDf_W-qgn8XEy6',
fit: 'contain',
},
commonStyle: {}
},
{
eleName: 'cr-nav-bar',
title: 'NavBar 导航栏',
h: 48,
config: [
{
key: 'title',
name: '标题',
desc: '标题',
propType: 'string',
options: [],
type: 'text'
},
{
key: 'leftText',
name: '左侧文案',
desc: '左侧文案',
propType: 'string',
options: [],
type: 'text'
},
{
key: 'rightText',
name: '右侧文案',
desc: '右侧文案',
default: '',
options: [
'info',
'danger',
'primary',
'warning'
],
type: 'text'
},
{
key: 'leftArrow',
name: '左侧箭头',
desc: '是否显示左侧箭头',
propType: 'boolean',
options: [],
type: 'checkbox'
},
{
key: 'border',
name: '边框',
desc: '是否显示下边框',
propType: 'boolean',
options: [],
type: 'checkbox'
},
{
key: 'fixed',
name: '固定导航栏',
desc: '是否固定导航栏',
propType: 'boolean',
options: [],
type: 'checkbox'
},
{
key: 'zIndex',
name: 'z-index',
desc: '元素z-index',
propType: [
'number',
'string'
],
options: [],
type: 'text'
}
],
value: {
title: '',
leftText: '返回',
rightText: '',
leftArrow: true,
border: true,
fixed: true,
zIndex: '9999'
},
commonStyle: {}
}
];
export const businessComponents = [
{
......
......@@ -23,7 +23,7 @@ export default class Activity extends Vue {
@Watch('pageName', { immediate: true })
onPageNameChange(newVal) {
if (newVal) {
if (EASY_ENV_IS_BROWSER && newVal) {
document.title = newVal;
// 如果是 iOS 设备,则使用如下 hack 的写法实现页面标题的更新
if (navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)) {
......
......@@ -119,6 +119,9 @@ export default class DynamicForm extends Mixins(ContextMenu) {
case 'number' :
result = 'Number';
break;
case 'Upload':
result = 'Upload';
break;
}
return result;
}
......
......@@ -16,6 +16,8 @@ export default class FreedomContainer extends Mixins(ContextMenu) {
@Prop({ type: Boolean, default: false }) showHeader;
@Prop(String) backgroundImage;
dots: object = {};
mousedown(childIndex, event) {
this.setDragable(false);
const childItem = cloneDeep(this.childItem);
......@@ -63,7 +65,7 @@ export default class FreedomContainer extends Mixins(ContextMenu) {
@Watch('curChildIndex')
onIndexChange(newVal) {
this.childItem.child.forEach(item => delete item.dots);
this.dots = {};
if (newVal || newVal === 0) {
this.setPointStyle();
}
......@@ -74,14 +76,12 @@ export default class FreedomContainer extends Mixins(ContextMenu) {
this.$nextTick(() => {
const points = ['lt', 'rt', 'lb', 'rb', 'l', 'r', 't', 'b'];
const [height, width] = this.getHW(this.curChildIndex);
const dots = points.reduce((pre, cur) => {
this.dots[this.curChildIndex] = points.reduce((pre, cur) => {
pre[cur] = convertPointStyle(cur, {height, width});
return pre;
}, {});
const childEle = this.childItem.child[this.curChildIndex];
// this.updatePageInfo({ containerIndex: this.containerIndex, childIndex: this.curChildIndex, data: { ...childEle, commonStyle: { ...childEle.commonStyle, height: +height, width: +width } } });
this.updateCommonStyle({ containerIndex: this.containerIndex, childIndex: this.curChildIndex, data: { ...childEle.commonStyle, height: +height, width: +width }});
this.$set(this.childItem.child[this.curChildIndex], 'dots', dots);
});
}
......
......@@ -4,7 +4,7 @@
<div v-for="(item, index) in childItem.child" :style="transformStyle(item.commonStyle, 'container')" :class="['freedom-body-item', { 'Fb-item_selected': curChildIndex === index }]" :key="index" @click.stop="handleElementClick(containerIndex, index)" @mousedown.stop="mousedown(index, $event)" @contextmenu.prevent.stop="show($event, containerIndex, index)">
<component ref="childComponent" :style="transformStyle(item.commonStyle, 'component')" :is="item.name" v-bind="item.props"></component>
<div class="freedom-body-dot"
v-for="(style, key) in item.dots"
v-for="(style, key) in dots[index]"
:key="key"
:style="style"
@mousedown.stop.prevent="handleMouseDownOnPoint(key, $event)"/>
......
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