feat: base checkPropsUntilReady
This commit is contained in:
parent
e2f3254e46
commit
cf280974c2
|
|
@ -142,6 +142,7 @@ const initFileList = () => {
|
|||
else if (props.xtype === "path" && props.modelValue) {
|
||||
props.modelValue.forEach(item => {
|
||||
clist.push({
|
||||
name: item.substring(item.lastIndexOf('/') + 1, item.length),
|
||||
path: item,
|
||||
url: `${config.hostUrl}${item}`,
|
||||
percent: 100,
|
||||
|
|
@ -161,6 +162,7 @@ const initFileList = () => {
|
|||
fileList.value = clist
|
||||
} else if (props.xtype === "path" && props.modelValue) {
|
||||
clist.push({
|
||||
name: item.substring(item.lastIndexOf('/') + 1, item.length),
|
||||
path: props.modelValue,
|
||||
url: `${config.hostUrl}${props.modelValue}`,
|
||||
percent: 100,
|
||||
|
|
@ -193,6 +195,13 @@ const preview = (item) => {
|
|||
uni.previewImage({
|
||||
current: currentIndex >= 0 ? currentIndex : 0,
|
||||
urls: urls,
|
||||
fail: function(err) {
|
||||
console.log(err);
|
||||
uni.showToast({
|
||||
title: "预览失败",
|
||||
icon: "none"
|
||||
})
|
||||
}
|
||||
})
|
||||
} else if (item.type == 10) {
|
||||
uni.downloadFile({
|
||||
|
|
@ -206,6 +215,13 @@ const preview = (item) => {
|
|||
console.log('打开文档成功');
|
||||
}
|
||||
});
|
||||
},
|
||||
fail: function (err) {
|
||||
console.log("下载失败:", err)
|
||||
uni.showToast({
|
||||
title: "下载失败",
|
||||
icon: "none"
|
||||
})
|
||||
}
|
||||
});
|
||||
} else if (item.type == 20) {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import API from '@/utils/api';
|
|||
|
||||
const props = defineProps({
|
||||
workflow_key: {type: String, default: null, required: false},
|
||||
ticket_: {type: Object, default: null, required: false},
|
||||
ticket_: {type: [Object, String], default: "pending", required: false},
|
||||
t_id: {type: String, default: null, required: true},
|
||||
title: {type: String, default: null, required: false},
|
||||
submit_b_func: {type: Function, default: null, required: false},
|
||||
|
|
@ -26,18 +26,20 @@ const workflow = ref(null);
|
|||
const transitions = ref([]);
|
||||
const currentUser = ref(uni.getStorageSync("userInfo").id);
|
||||
onMounted(async () => {
|
||||
setTimeout(()=>{init()}, 1000)
|
||||
// await init();
|
||||
// watch(
|
||||
// () => props.ticket_,
|
||||
// async (newVal) => {
|
||||
// if (newVal && Object.keys(newVal).length > 0) {
|
||||
// await init();
|
||||
// }
|
||||
// },
|
||||
// { deep: true }
|
||||
// )
|
||||
checkPropsUntilReady()
|
||||
})
|
||||
const inited = ref(false)
|
||||
const checkPropsUntilReady = () => {
|
||||
if (inited.value) return
|
||||
|
||||
if (props.ticket_ !== "pending") {
|
||||
init()
|
||||
inited.value = true
|
||||
return
|
||||
}
|
||||
// ⭐ 每 200ms 查一次(非常轻量)
|
||||
setTimeout(checkPropsUntilReady, 200)
|
||||
}
|
||||
const suggestion = ref("")
|
||||
const isOwn = ref(false)
|
||||
const ticketId = ref(null)
|
||||
|
|
|
|||
Loading…
Reference in New Issue