first commit
This commit is contained in:
84
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/draggable/draggable.js
vendored
Normal file
84
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/draggable/draggable.js
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
"use strict";
|
||||
const uni_modules_tdesignUniapp_components_common_src_instantiationDecorator = require("../common/src/instantiationDecorator.js");
|
||||
const uni_modules_tdesignUniapp_components_common_config = require("../common/config.js");
|
||||
const uni_modules_tdesignUniapp_components_draggable_props = require("./props.js");
|
||||
const uni_modules_tdesignUniapp_components_common_utils = require("../common/utils.js");
|
||||
const uni_modules_tdesignUniapp_components_common_utils_wxs = require("../common/utils.wxs.js");
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_tdesignUniapp_components_common_wechat = require("../common/wechat.js");
|
||||
const name = `${uni_modules_tdesignUniapp_components_common_config.prefix}-draggable`;
|
||||
const _sfc_main = uni_modules_tdesignUniapp_components_common_src_instantiationDecorator.uniComponent({
|
||||
name,
|
||||
options: {
|
||||
styleIsolation: "shared"
|
||||
},
|
||||
props: {
|
||||
...uni_modules_tdesignUniapp_components_draggable_props.props
|
||||
},
|
||||
emits: [
|
||||
"move",
|
||||
"start",
|
||||
"end"
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
prefix: uni_modules_tdesignUniapp_components_common_config.prefix,
|
||||
classPrefix: name,
|
||||
tools: uni_modules_tdesignUniapp_components_common_utils_wxs.tools,
|
||||
systemInfo: uni_modules_tdesignUniapp_components_common_wechat.getWindowInfo()
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.computedRect();
|
||||
},
|
||||
methods: {
|
||||
onTouchStart(e) {
|
||||
const { systemInfo } = this;
|
||||
if (this.direction === "none")
|
||||
return;
|
||||
this.startX = e.touches[0].clientX + systemInfo.windowWidth - this.rect.right;
|
||||
this.startY = e.touches[0].clientY + systemInfo.windowHeight - this.rect.bottom;
|
||||
this.$emit("start", { startX: this.startX, startY: this.startY, rect: this.rect, e });
|
||||
},
|
||||
onTouchMove(e) {
|
||||
const { systemInfo } = this;
|
||||
if (this.direction === "none")
|
||||
return;
|
||||
let x = this.startX - e.touches[0].clientX;
|
||||
let y = this.startY - e.touches[0].clientY;
|
||||
if (this.direction === "vertical") {
|
||||
x = systemInfo.windowWidth - this.rect.right;
|
||||
}
|
||||
if (this.direction === "horizontal") {
|
||||
y = systemInfo.windowHeight - this.rect.bottom;
|
||||
}
|
||||
this.$emit("move", { x, y, rect: this.rect, e });
|
||||
},
|
||||
async onTouchEnd(e) {
|
||||
if (this.direction === "none")
|
||||
return;
|
||||
await this.computedRect();
|
||||
this.$emit("end", { rect: this.rect, e });
|
||||
},
|
||||
async computedRect() {
|
||||
this.rect = { right: 0, bottom: 0, width: 0, height: 0 };
|
||||
try {
|
||||
this.rect = await uni_modules_tdesignUniapp_components_common_utils.getRect(this, `.${this.classPrefix}`);
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: common_vendor.n(_ctx.classPrefix),
|
||||
b: common_vendor.n(_ctx.tClass),
|
||||
c: common_vendor.s(_ctx.tools._style([_ctx.customStyle])),
|
||||
d: common_vendor.o((...args) => _ctx.onTouchStart && _ctx.onTouchStart(...args)),
|
||||
e: common_vendor.o((...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args)),
|
||||
f: common_vendor.o((...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args))
|
||||
};
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-02b06622"]]);
|
||||
wx.createComponent(Component);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/tdesign-uniapp/components/draggable/draggable.js.map
|
||||
4
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/draggable/draggable.json
vendored
Normal file
4
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/draggable/draggable.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/draggable/draggable.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/draggable/draggable.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="{{['data-v-02b06622', a, b]}}" style="{{c}}" bindtouchstart="{{d}}" catchtouchmove="{{e}}" bindtouchend="{{f}}"><slot/></view>
|
||||
16
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/draggable/draggable.wxss
vendored
Normal file
16
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/draggable/draggable.wxss
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
.hotspot-expanded.relative.data-v-02b06622 {
|
||||
position: relative;
|
||||
}
|
||||
.hotspot-expanded.data-v-02b06622::after {
|
||||
content: '';
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
transform: scale(1.5);
|
||||
}
|
||||
.t-draggable.data-v-02b06622 {
|
||||
position: fixed;
|
||||
}
|
||||
21
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/draggable/props.js
vendored
Normal file
21
unpackage/dist/dev/mp-weixin/uni_modules/tdesign-uniapp/components/draggable/props.js
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
const props = {
|
||||
direction: {
|
||||
type: String,
|
||||
value: "all"
|
||||
},
|
||||
tClass: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
tClassButton: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
customStyle: {
|
||||
type: [String, Object],
|
||||
default: ""
|
||||
}
|
||||
};
|
||||
exports.props = props;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/tdesign-uniapp/components/draggable/props.js.map
|
||||
Reference in New Issue
Block a user