refactor: 确立独立子工程架构 (backend, admin, mpuniapp) 并同步更新 AGENTS.md 规范
这个提交包含在:
@@ -0,0 +1,46 @@
|
||||
<template>
|
||||
<!-- #ifdef APP -->
|
||||
<native-view @init="onviewinit"></native-view>
|
||||
<!-- #endif -->
|
||||
<!-- #ifndef APP -->
|
||||
<view></view>
|
||||
<!-- #endif -->
|
||||
</template>
|
||||
<script setup lang="uts">
|
||||
// #ifdef APP
|
||||
import { TestNativeView } from "@/uni_modules/test-native-view";
|
||||
let view : TestNativeView | null = null
|
||||
|
||||
// Style样式监听
|
||||
const style = useComputedStyle({
|
||||
properties: ['background-color'],
|
||||
filterProperties: true
|
||||
} as UseComputedStyleOptions)
|
||||
const backgroundColor = computed<string>(() => {
|
||||
return style.get('background-color')?.toString() ?? '#FFFFFF'
|
||||
})
|
||||
|
||||
/**
|
||||
* 监听background-color变化
|
||||
*/
|
||||
watch([backgroundColor], () => {
|
||||
view?.updateBackground(backgroundColor.value)
|
||||
})
|
||||
|
||||
/**
|
||||
* native-view组件初始化时触发
|
||||
* 用于绑定App平台原生View
|
||||
*/
|
||||
function onviewinit(e : UniNativeViewInitEvent) {
|
||||
view = new TestNativeView(e.detail.element)
|
||||
view?.updateBackground(backgroundColor.value)
|
||||
}
|
||||
|
||||
/**
|
||||
* App平台主动释放资源
|
||||
*/
|
||||
onUnmounted(() => {
|
||||
view?.destroy()
|
||||
})
|
||||
// #endif
|
||||
</script>
|
||||
在新工单中引用
屏蔽一个用户