fix: field
parent
3a740b5abd
commit
37c5e41bcf
|
@ -46,9 +46,8 @@ const processedActions = ref<any[]>([]);
|
||||||
const processedDropdownActions = ref<any[]>([]);
|
const processedDropdownActions = ref<any[]>([]);
|
||||||
|
|
||||||
/** 用于比较的字符串化版本 */
|
/** 用于比较的字符串化版本 */
|
||||||
// TODO @xingyu:下面的拼写错误,需要修改
|
const actionsStringField = ref('');
|
||||||
const actionsStringified = ref('');
|
const dropdownActionsStringField = ref('');
|
||||||
const dropdownActionsStringified = ref('');
|
|
||||||
|
|
||||||
function isIfShow(action: ActionItem): boolean {
|
function isIfShow(action: ActionItem): boolean {
|
||||||
const ifShow = action.ifShow;
|
const ifShow = action.ifShow;
|
||||||
|
@ -112,7 +111,7 @@ function processDropdownActions(
|
||||||
/** 监听 actions 变化并更新缓存 */
|
/** 监听 actions 变化并更新缓存 */
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
const rawActions = toRaw(props.actions) || [];
|
const rawActions = toRaw(props.actions) || [];
|
||||||
const currentStringified = JSON.stringify(
|
const currentStringField = JSON.stringify(
|
||||||
rawActions.map((a) => ({
|
rawActions.map((a) => ({
|
||||||
...a,
|
...a,
|
||||||
onClick: undefined, // 排除函数以便比较
|
onClick: undefined, // 排除函数以便比较
|
||||||
|
@ -122,8 +121,8 @@ watchEffect(() => {
|
||||||
})),
|
})),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (currentStringified !== actionsStringified.value) {
|
if (currentStringField !== actionsStringField.value) {
|
||||||
actionsStringified.value = currentStringified;
|
actionsStringField.value = currentStringField;
|
||||||
processedActions.value = processActions(rawActions);
|
processedActions.value = processActions(rawActions);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -131,7 +130,7 @@ watchEffect(() => {
|
||||||
/** 监听 dropDownActions 变化并更新缓存 */
|
/** 监听 dropDownActions 变化并更新缓存 */
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
const rawDropDownActions = toRaw(props.dropDownActions) || [];
|
const rawDropDownActions = toRaw(props.dropDownActions) || [];
|
||||||
const currentStringified = JSON.stringify({
|
const currentStringField = JSON.stringify({
|
||||||
actions: rawDropDownActions.map((a) => ({
|
actions: rawDropDownActions.map((a) => ({
|
||||||
...a,
|
...a,
|
||||||
onClick: undefined, // 排除函数以便比较
|
onClick: undefined, // 排除函数以便比较
|
||||||
|
@ -142,8 +141,8 @@ watchEffect(() => {
|
||||||
divider: props.divider,
|
divider: props.divider,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (currentStringified !== dropdownActionsStringified.value) {
|
if (currentStringField !== dropdownActionsStringField.value) {
|
||||||
dropdownActionsStringified.value = currentStringified;
|
dropdownActionsStringField.value = currentStringField;
|
||||||
processedDropdownActions.value = processDropdownActions(
|
processedDropdownActions.value = processDropdownActions(
|
||||||
rawDropDownActions,
|
rawDropDownActions,
|
||||||
props.divider,
|
props.divider,
|
||||||
|
|
Loading…
Reference in New Issue