refactor: 确立独立子工程架构 (backend, admin, mpuniapp) 并同步更新 AGENTS.md 规范
这个提交包含在:
@@ -0,0 +1,27 @@
|
||||
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
|
||||
const isWeb = platformInfo.startsWith('web')
|
||||
let page;
|
||||
describe('movable-view.uvue', () => {
|
||||
if (!isWeb) {
|
||||
it('skip', () => {
|
||||
expect(1).toBe(1)
|
||||
})
|
||||
return
|
||||
}
|
||||
it('移动至 (30px, 30px)', async () => {
|
||||
page = await program.reLaunch('/pages/component/movable-view/movable-view')
|
||||
await page.waitFor('view');
|
||||
expect((await page.data('x'))._value).toBe(0)
|
||||
expect((await page.data('y'))._value).toBe(0)
|
||||
await page.callMethod('tap')
|
||||
await page.waitFor(500);
|
||||
expect((await page.data('x'))._value).toBe(30)
|
||||
expect((await page.data('y'))._value).toBe(30)
|
||||
})
|
||||
it('放大3倍', async () => {
|
||||
expect((await page.data('scale'))._value).toBe(2)
|
||||
await page.callMethod('tap2')
|
||||
await page.waitFor(500);
|
||||
expect((await page.data('scale'))._value).toBe(3)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,134 @@
|
||||
<template>
|
||||
<view class="page-body">
|
||||
<page-head title="movable-view,可拖动视图"></page-head>
|
||||
<view class="uni-padding-wrap uni-common-mt">
|
||||
<view class="uni-title uni-common-mt">
|
||||
示例 1
|
||||
<text>\nmovable-view 区域小于 movable-area</text>
|
||||
</view>
|
||||
<movable-area>
|
||||
<movable-view :x="x" :y="y" direction="all" @change="onChange">text</movable-view>
|
||||
</movable-area>
|
||||
<view @tap="tap" class="uni-link uni-center uni-common-mt">
|
||||
点击这里移动至 (30px, 30px)
|
||||
</view>
|
||||
<view class="uni-title uni-common-mt">
|
||||
示例 2
|
||||
<text>\nmovable-view区域大于movable-area</text>
|
||||
</view>
|
||||
<movable-area>
|
||||
<movable-view class="max" direction="all">text</movable-view>
|
||||
</movable-area>
|
||||
<view class="uni-title uni-common-mt">
|
||||
示例 3
|
||||
<text>\n只可以横向移动</text>
|
||||
</view>
|
||||
<movable-area>
|
||||
<movable-view direction="horizontal">text</movable-view>
|
||||
</movable-area>
|
||||
<view class="uni-title uni-common-mt">
|
||||
示例 4
|
||||
<text>\n只可以纵向移动</text>
|
||||
</view>
|
||||
<movable-area>
|
||||
<movable-view direction="vertical">text</movable-view>
|
||||
</movable-area>
|
||||
<view class="uni-title uni-common-mt">
|
||||
示例 5
|
||||
<text>\n可超出边界</text>
|
||||
</view>
|
||||
<movable-area>
|
||||
<movable-view direction="all" out-of-bounds>text</movable-view>
|
||||
</movable-area>
|
||||
<view class="uni-title uni-common-mt">
|
||||
示例 6
|
||||
<text>\n带有惯性</text>
|
||||
</view>
|
||||
<movable-area>
|
||||
<movable-view direction="all" inertia>text</movable-view>
|
||||
</movable-area>
|
||||
<view class="uni-title uni-common-mt">
|
||||
示例 7
|
||||
<text>\n可放缩</text>
|
||||
</view>
|
||||
<movable-area scale-area>
|
||||
<movable-view direction="all" @scale="onScale" scale scale-min="0.5" scale-max="4"
|
||||
:scale-value="scale">text</movable-view>
|
||||
</movable-area>
|
||||
<view @tap="tap2" class="uni-link uni-center uni-common-mt" style="padding-bottom:40px;">
|
||||
点击这里放大3倍
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
const x = ref(0)
|
||||
const y = ref(0)
|
||||
const scale = ref(2)
|
||||
const old = reactive({
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 2
|
||||
})
|
||||
|
||||
const tap = (e) => {
|
||||
// 解决view层不同步的问题
|
||||
x.value = old.x
|
||||
y.value = old.y
|
||||
nextTick(() => {
|
||||
x.value = 30
|
||||
y.value = 30
|
||||
})
|
||||
}
|
||||
|
||||
const tap2 = () => {
|
||||
// 解决view层不同步的问题
|
||||
scale.value = old.scale
|
||||
nextTick(() => {
|
||||
scale.value = 3
|
||||
})
|
||||
}
|
||||
|
||||
const onChange = (e) => {
|
||||
old.x = e.detail.x
|
||||
old.y = e.detail.y
|
||||
}
|
||||
|
||||
const onScale = (e) => {
|
||||
old.scale = e.detail.scale
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
x,
|
||||
y,
|
||||
scale,
|
||||
tap,
|
||||
tap2 // 仅供自动化测试用例调用
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
movable-view {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 75px;
|
||||
width: 75px;
|
||||
background-color: #007AFF;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
movable-area {
|
||||
height: 150px;
|
||||
width: 100%;
|
||||
background-color: #D8D8D8;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.max {
|
||||
width: 250px;
|
||||
height: 250px;
|
||||
}
|
||||
</style>
|
||||
在新工单中引用
屏蔽一个用户