提交 2d93680a 编写于 作者: S shenjizhe

1

上级 746a674a
......@@ -14,6 +14,6 @@ unpackage/dist/dev/
# python
*.pyc
uni_modules/
!uni_modules/thirdlucky-uml-entity/**/*
uni_modules/!thirdlucky*
!uni_modules/thirdlucky-uml-entity/**/**
.hbuilderx/
<template>
<movable-view
class="active"
:style="{ width: title.length * 0.75 + 'em', height: columns.length * 1.4 + 2 + 'em' }"
id="entity"
:x="x"
:y="y"
direction="all"
@touchstart="touchstart"
@touchmove.stop="touchmove"
@touchend="touchend"
>
<text class="title">{{ _title }}</text>
<text class="content" v-for="(col, index, key) in _columns" :v-if="index < 10" :key="col.name">{{ col.name }} : {{ col.type }}</text>
</movable-view>
</template>
<script>
export default {
emits: ['move', 'start', 'end'],
props: {
name: 'uml-entity',
entityName: {
type: String,
required: true
},
title: {
type: String,
required: false,
default: '实体'
},
columns: {
type: Array,
required: false,
default() {
return [];
}
}
},
data() {
return {
x: 0,
y: 0,
scale: 2,
old: {
x: 0,
y: 0,
scale: 2
}
};
},
computed: {
_title() {
let text = this.$props.title;
if (text.length > 14) {
return text.substr(0, 13) + '...';
}
return this.$props.title;
},
_entityname() {
return this.$props.entityName;
},
_columns: {
get() {
let cols = this.$props.columns;
if (cols.length <= 10) {
return this.$props.columns;
} else {
return this.$props.columns.slice(0, 9).concat({
name: '忽略',
info: '',
type: '...'
});
}
}
}
},
methods: {
touchstart(e) {
this.touch(e, 'start');
},
touchmove(e) {
this.touch(e, 'move');
},
touchend(e) {
this.touch(e, 'end');
},
touch(e, event) {
let entityname = this._entityname;
let touch = e.changedTouches[0];
this.$emit(event, entityname, e.type, touch.clientX, touch.clientY);
},
input(e) {
console.log(e);
}
}
};
</script>
<style lang="scss">
$window-height: 93vh;
$border-width: 5rpx;
$control-width: 200rpx;
$control-height: 200rpx;
$max-width: 300rpx;
$max-height: 500rpx;
@function resize() {
@return 0;
}
.active {
display: flex;
flex-direction: column;
min-width: $control-width;
min-height: $control-height;
max-width: $max-width;
max-height: $max-height;
background-color: #ffffff;
color: #ffffff;
border-color: #333333;
border-radius: 10px;
border-style: solid;
// position: absolute;
top: 20rpx;
left: 20rpx;
border-width: $border-width;
}
.title {
background-color: #55aaff;
color: #ffffff;
border-color: #2c405a;
border-bottom-style: dashed;
border-radius: 8px 8px 0 0;
text-align: center;
border-width: $border-width;
}
.content {
margin-left: 10rpx;
margin-top: 10rpx;
color: #000000;
font-size: 0.75em;
}
</style>
{
"id": "thirdlucky-uml-entity",
"displayName": "thirdlucky-uml-entity",
"version": "1.0.0",
"description": "thirdlucky-uml-entity",
"keywords": [
"thirdlucky-uml-entity"
],
"repository": "",
"engines": {
"HBuilderX": "^3.1.0"
},
"dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "",
"data": "",
"permissions": ""
},
"npmurl": ""
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "u",
"aliyun": "u"
},
"client": {
"Vue": {
"vue2": "u",
"vue3": "u"
},
"App": {
"app-vue": "u",
"app-nvue": "u"
},
"H5-mobile": {
"Safari": "u",
"Android Browser": "u",
"微信浏览器(Android)": "u",
"QQ浏览器(Android)": "u"
},
"H5-pc": {
"Chrome": "u",
"IE": "u",
"Edge": "u",
"Firefox": "u",
"Safari": "u"
},
"小程序": {
"微信": "u",
"阿里": "u",
"百度": "u",
"字节跳动": "u",
"QQ": "u"
},
"快应用": {
"华为": "u",
"联盟": "u"
}
}
}
}
}
\ No newline at end of file
# thirdlucky-uml-entity
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册