在文档 https://doc.dcloud.net.cn/uni-app-x/vue/data-bind.html#defineexpose
<script setup lang="uts">
const fooRef = ref<DefineExposeFooComponentPublicInstance | null>(null)
const fooStr = ref('')
const fooNum = ref<number>(0)
DefineExposeFooComponentPublicInstance 在哪里定义的?在安卓编译时报错。
下面是我定义的type
type TPickerExpose = { setPickerVisible: (s: boolean) => void }
const pickerUvueRef = ref<TPickerExpose | null>(null);
14:26:49.895 error: java.lang.ClassCastException: uni.UNIDBEF90B.GenPagesCreatePicker cannot be cast to uni.UNIDBEF90B.TPickerExpose
14:26:49.895 at pages/create/task.uvue:183:3
14:26:49.895 181| const openPickerPage = () => {
14:26:49.895 182| if (pickerUvueRef.value != null) {
14:26:49.895 183| const pickerRef = pickerUvueRef.value;
14:26:49.895 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14:26:49.895 184| pickerRef.setPickerVisible(true);
14:26:49.895 185| }
0 个回复