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

fix: dots保存在组件内部

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