提交 f5d577c4 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

refactor: 优化代码

上级 5f70c618
......@@ -16,28 +16,26 @@
</template>
<script setup lang="uts">
defineProps({
title: {
type: String,
default: ''
},
num: {
type: Number,
default: 0
},
checked: {
type: Boolean,
default: false
},
obj: {
// #ifdef APP-ANDROID
// TODO: 确认类型是否合理
type: FooPropsObj1ReactiveObject,
// #endif
// #ifdef APP-IOS || WEB
type: Object,
// #endif
required: true
export type FooPropsObj = {
name : string
}
})
</script>
defineProps({
title: {
type: String,
default: ''
},
num: {
type: Number,
default: 0
},
checked: {
type: Boolean,
default: false
},
obj: {
type: FooPropsObj,
required: true
}
})
</script>
\ No newline at end of file
......@@ -15,7 +15,11 @@
</view>
</template>
<script lang="uts">
<script lang="uts">
export type FooPropsObj = {
name : string
}
export default {
props: {
title: {
......@@ -31,12 +35,7 @@
default: false
},
obj: {
// #ifdef APP-ANDROID
type: FooPropsObjReactiveObject,
// #endif
// #ifdef APP-IOS || WEB
type: Object,
// #endif
type: FooPropsObj,
required: true
}
}
......
......@@ -42,10 +42,8 @@
<script setup lang="uts">
import Foo from './Foo-composition.uvue'
import {type FooPropsObj} from './Foo-composition.uvue'
type FooPropsObj = {
name : string
}
type FooProps = {
title : string
num : number
......@@ -69,7 +67,7 @@ const dataInfo = reactive({
num: 1,
obj: {
name: 'foo obj name',
}
} as FooPropsObj
},
vBindClassBackgroundColor: 'red',
vBindClassRpxHeight: '300rpx'
......
......@@ -32,10 +32,8 @@
<script lang="uts">
import Foo from './Foo-options.uvue'
import {type FooPropsObj} from './Foo-options.uvue'
type FooPropsObj = {
name: string
}
type FooProps = {
title: string
num: number
......@@ -63,7 +61,7 @@ export default {
num: 1,
obj: {
name: 'foo obj name'
}
} as FooPropsObj
},
vBindClassBackgroundColor: 'red',
vBindClassRpxHeight: '300rpx'
......
......@@ -8,10 +8,10 @@
import { state } from '@/store/index.uts'
onReady(() => {
throw Error('error in error composition page onReady')
throw new Error('error in error composition page onReady')
})
const triggerError = () => {
throw Error('trigger error in throw error composition page')
throw new Error('trigger error in throw error composition page')
}
// 自动化测试
......
......@@ -9,11 +9,11 @@ import { state } from '@/store/index.uts'
export default {
onReady(){
throw Error('error in error options page onReady')
throw new Error('error in error options page onReady')
},
methods: {
triggerError(){
throw Error('trigger error in throw error options page')
throw new Error('trigger error in throw error options page')
},
// 自动化测试
getLifeCycleNum() : number {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册