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

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

查看文件

@@ -0,0 +1,47 @@
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
const isWeb = platformInfo.startsWith('web') || platformInfo.startsWith('h5')
const PAGE_PATH = '/pages/template/browser-built-in-elements/browser-built-in-elements'
jest.setTimeout(60000)
describe('template-browser-built-in-elements', () => {
if (!isWeb) {
it('only supports web runtime', () => {
expect(1).toBe(1)
})
return
}
let page
beforeAll(async () => {
page = await program.reLaunch(PAGE_PATH)
await page.waitFor('view')
await page.waitFor('text')
await page.waitFor(1000)
})
it('renders page titles and browser link', async () => {
const titles = await page.$$('.title')
expect(titles.length).toBe(2)
expect(await titles[0].text()).toBe('使用浏览器内置的 a 标签')
expect(await titles[1].text()).toContain('button 标签')
const nativeState = await page.callMethod('jest_getNativeState')
expect(nativeState.linkText).toContain('uni-app x')
expect(nativeState.linkHref).toContain('doc.dcloud.net.cn/uni-app-x/')
expect(nativeState.linkTarget).toBe('uni-app-x')
})
it('creates the browser native button in placeholder area', async () => {
const container = await page.$('.html-element-area')
const nativeState = await page.callMethod('jest_getNativeState')
expect(nativeState.buttonCount).toBe(1)
expect(nativeState.buttonText).toBe('browser button')
const containerSize = await container.size()
expect(containerSize.width).toBeGreaterThan(0)
})
})

查看文件

@@ -0,0 +1,73 @@
<template>
<view class="page">
<page-head :title="title"></page-head>
<view class="page-body">
<text class="title">使用浏览器内置的 a 标签</text>
<view>
<a class="browser-native-link" href="https://doc.dcloud.net.cn/uni-app-x/" target="uni-app-x">uni-app x,是下一代 uni-app,是一个跨平台应用开发引擎</a>
</view>
<text class="title">使用浏览器内置的 button 标签(浏览器内置标签和 uni-app 重名的情况)</text>
<view class="html-element-area" ref="htmlElementAreaRef"></view>
</view>
</view>
</template>
<script setup lang="uts">
/**
* @description: 演示在 Web 平台中混合使用浏览器原生 HTML 元素与 uni-app x 页面内容。
* @logic: 页面先展示原生 a 标签链接,再在 onReady 阶段动态创建浏览器原生 button 元素并挂载到占位容器中。
* @optimization: 使用独立占位容器承接原生元素插入,减少对页面其他结构的影响,便于隔离浏览器内置元素的行为验证。
*/
const title = '浏览器内置元素'
const htmlElementAreaRef = ref<HTMLElement | null>(null)
type JestNativeState = {
linkText : string;
linkHref : string;
linkTarget : string;
buttonText : string;
buttonCount : number;
}
function jest_getNativeState() : JestNativeState {
const linkElement = document.querySelector('.browser-native-link') as HTMLAnchorElement | null
const buttonElement = document.querySelector('.browser-native-button') as HTMLButtonElement | null
let buttonCount = 0
if (htmlElementAreaRef.value != null) {
buttonCount = htmlElementAreaRef.value!.childElementCount
}
return {
linkText: linkElement?.innerText ?? '',
linkHref: linkElement?.getAttribute('href') ?? '',
linkTarget: linkElement?.getAttribute('target') ?? '',
buttonText: buttonElement?.innerText ?? '',
buttonCount,
} as JestNativeState
}
onReady(() => {
if (htmlElementAreaRef.value != null) {
const buttonElement = document.createElement('button') as HTMLButtonElement;
// 自动化测试辅助:补充稳定 class 选择器,便于测试读取原生 button 状态。
buttonElement.className = 'browser-native-button';
buttonElement.innerText = 'browser button';
htmlElementAreaRef.value!.appendChild(buttonElement);
}
})
defineExpose({
jest_getNativeState,
})
</script>
<style>
.page {
padding: 15px;
}
.title {
margin-top: 15px;
}
</style>