refactor: 确立独立子工程架构 (backend, admin, mpuniapp) 并同步更新 AGENTS.md 规范

这个提交包含在:
wikiboss
2026-09-20 17:05:22 +08:00
父节点 de3cf8b870
当前提交 9fa1d1fbd0
共有 1679 个文件被更改,包括 204798 次插入 和 16817 次删除

查看文件

@@ -0,0 +1,54 @@
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
const isWeb = platformInfo.startsWith('web')
const isHarmony = platformInfo.startsWith('harmony')
const isDom2 = process.env.UNI_APP_X_DOM2 == 'true'
let page;
describe('label.uvue', () => {
if (!isWeb && !isHarmony) {
it('app', () => {
expect(1).toBe(1)
})
return
}
beforeAll(async () => {
page = await program.reLaunch('/pages/component/label/label')
await page.waitFor('view');
});
afterEach(async() => {
await page.setData({
data:{
checkboxValue: [],
radioValue:''
}
})
});
function getData(key = '') {
return new Promise(async (resolve, reject) => {
const data = await page.data('data')
resolve(key ? data[key] : data)
})
}
it('表单组件在label内', async () => {
expect(await getData('checkboxValue')).toEqual([])
const checkboxItems = await page.$$('.checkboxItemsTest')
await checkboxItems[0].tap()
expect(await getData('checkboxValue')).toEqual(['USA', 'CHN'])
})
it('label用for标识表单组件', async () => {
if (isDom2 && isHarmony) {
expect(1).toBe(1)
return
}
const radioItems = await page.$$('.label-2-text')
await radioItems[0].tap()
expect(await getData('radioValue')).toEqual('USA')
await radioItems[1].tap()
expect(await getData('radioValue')).toEqual('CHN')
})
it('label内有多个时选中第一个', async () => {
const labelText = await page.$('.uni-center')
await labelText.tap()
expect(await getData('checkboxForValue')).toEqual(['for1'])
})
})

查看文件

@@ -0,0 +1,157 @@
<template>
<view>
<page-head :title="data.title"></page-head>
<view class="uni-common-mt">
<view class="uni-form-item uni-column">
<view class="title">表单组件在label内</view>
<checkbox-group class="uni-list" @change="checkboxChange">
<label class="uni-list-cell uni-list-cell-pd checkboxItemsTest label" v-for="item in data.checkboxItems"
:key="item.name">
<view>
<checkbox :value="item.name" :checked="item.checked"></checkbox>
</view>
<view>{{item.value}}</view>
</label>
</checkbox-group>
</view>
<!-- #ifndef VUE3-VAPOR -->
<view class="uni-form-item uni-column">
<view class="title">label用for标识表单组件</view>
<radio-group class="uni-list radio-group" @change="radioChange">
<view class="uni-list-cell uni-list-cell-pd" v-for="(item,index) in data.radioItems" :key="index">
<view>
<radio :id="item.name" :value="item.name" :checked="item.checked"></radio>
</view>
<label class="label-2-text" :for="item.name">
<text>{{item.value}}</text>
</label>
</view>
</radio-group>
</view>
<!-- #endif -->
<view class="uni-form-item uni-column">
<view class="title">label内有多个时选中第一个</view>
<checkbox-group class="uni-list" @change="checkboxForChange">
<label class="label-3 label">
<view class="uni-list-cell uni-list-cell-pd">
<checkbox value="for1">选项一</checkbox>
<!-- #ifdef MP-ALIPAY -->
<text>选项一</text>
<!-- #endif -->
</view>
<view class="uni-list-cell uni-list-cell-pd">
<checkbox value="for2">选项二</checkbox>
<!-- #ifdef MP-ALIPAY -->
<text>选项二</text>
<!-- #endif -->
</view>
<view class="uni-center" style="margin:10px 0;">
<text class="uni-link">点击该label下的文字默认选中第一个checkbox</text>
</view>
</label>
</checkbox-group>
</view>
</view>
<navigator class="uni-common-mb" url="/pages/template/label-100/label-100">
<button>组件性能测试</button>
</navigator>
</view>
</template>
<script setup lang="uts">
type controlItem = {
name : string,
value : string,
checked ?: boolean
}
type DataType = {
title: string;
checkboxItems: controlItem[];
radioItems: controlItem[];
hidden: boolean;
checkboxValue: string[];
checkboxForValue: string[];
radioValue: string;
}
// 使用reactive避免ref数据在自动化测试中无法访问
const data = reactive({
title: 'label',
checkboxItems: [{
name: 'USA',
value: '美国'
},
{
name: 'CHN',
value: '中国',
checked: true
}
],
radioItems: [{
name: 'USA',
value: '美国'
},
{
name: 'CHN',
value: '中国',
checked: true
}
],
hidden: false,
checkboxValue: [] as string[],
checkboxForValue: [] as string[],
radioValue: ''
} as DataType)
const checkboxChange = (e : UniCheckboxGroupChangeEvent) => {
console.log(e.detail.value)
data.checkboxValue = e.detail.value
}
const checkboxForChange = (e : UniCheckboxGroupChangeEvent) => {
console.log(e.detail.value)
data.checkboxForValue = e.detail.value
}
const radioChange = (e : UniRadioGroupChangeEvent) => {
console.log(e.detail.value)
data.radioValue = e.detail.value
}
defineExpose({
data
})
</script>
<style>
.uni-list-cell {
justify-content: flex-start
}
.label-3 {
padding: 0;
}
.label-2-text {
flex: 1;
}
.uni-form-item {
display: flex;
width: 100%;
padding: 5px 0;
}
.title {
padding: 5px 12px;
}
.radio-group {
padding: 0 10px;
}
.label {
margin: 0 10px;
}
</style>