mirror of
https://github.com/smartxworks/sunmao-ui.git
synced 2024-11-21 03:15:49 +08:00
restore setValue and support 2 parameters
This commit is contained in:
parent
878eb6b318
commit
fd3f27a9e9
@ -43,9 +43,12 @@
|
||||
event: 'click',
|
||||
componentId: 'test_btn',
|
||||
method: {
|
||||
name: 'setCount',
|
||||
parameters:
|
||||
'{{ test_btn.count > 0 ? 0 : test_btn.count + 1 }}',
|
||||
name: 'setValue',
|
||||
parameters: {
|
||||
key: 'count',
|
||||
value:
|
||||
'{{ test_btn.count > 0 ? 0 : test_btn.count + 1 }}',
|
||||
},
|
||||
},
|
||||
wait: {},
|
||||
disabled: false,
|
||||
|
@ -42,8 +42,11 @@
|
||||
event: 'click',
|
||||
componentId: 'btn',
|
||||
method: {
|
||||
name: 'setCount',
|
||||
parameters: '{{ btn.count + 1 }}',
|
||||
name: 'setValue',
|
||||
parameters: {
|
||||
key: 'count',
|
||||
value: '{{ btn.count + 1 }}',
|
||||
},
|
||||
},
|
||||
wait: {},
|
||||
disabled: false,
|
||||
|
@ -52,9 +52,12 @@
|
||||
event: 'click',
|
||||
componentId: 'del_btn',
|
||||
method: {
|
||||
name: 'setCount',
|
||||
parameters:
|
||||
'{{ del_btn.count > 0 ? 0 : del_btn.count + 1 }}',
|
||||
name: 'setValue',
|
||||
parameters: {
|
||||
key: 'count',
|
||||
value:
|
||||
'{{ del_btn.count > 0 ? 0 : del_btn.count + 1 }}',
|
||||
},
|
||||
},
|
||||
wait: {},
|
||||
disabled: false,
|
||||
@ -63,8 +66,11 @@
|
||||
event: 'click',
|
||||
componentId: 'del_btn',
|
||||
method: {
|
||||
name: 'setCount',
|
||||
parameters: '0',
|
||||
name: 'setValue',
|
||||
parameters: {
|
||||
key: 'count',
|
||||
value: '0',
|
||||
},
|
||||
},
|
||||
wait: {
|
||||
type: 'delay',
|
||||
|
@ -44,8 +44,11 @@
|
||||
event: 'click',
|
||||
componentId: 'fetch_btn',
|
||||
method: {
|
||||
name: 'setToken',
|
||||
parameters: `{{ fetch_btn.token ? "":"01f0f6265bmsh0efd88b5c7dfa93p136d2ajsn8be6074b61b2" }}`,
|
||||
name: 'setValue',
|
||||
parameters: {
|
||||
key: 'count',
|
||||
value: `{{ fetch_btn.token ? "":"01f0f6265bmsh0efd88b5c7dfa93p136d2ajsn8be6074b61b2" }}`,
|
||||
},
|
||||
},
|
||||
wait: {},
|
||||
disabled: false,
|
||||
|
@ -141,8 +141,11 @@
|
||||
event: 'click',
|
||||
componentId: 'router',
|
||||
method: {
|
||||
name: 'setIndex',
|
||||
parameters: '{{router.index + 1}}',
|
||||
name: 'setValue',
|
||||
parameters: {
|
||||
key: 'index',
|
||||
value: '{{router.index + 1}}',
|
||||
},
|
||||
},
|
||||
wait: {},
|
||||
disabled: false,
|
||||
@ -181,8 +184,11 @@
|
||||
event: 'click',
|
||||
componentId: 'router',
|
||||
method: {
|
||||
name: 'setIndex',
|
||||
parameters: '2',
|
||||
name: 'setValue',
|
||||
parameters: {
|
||||
key: 'index',
|
||||
value: '2',
|
||||
},
|
||||
},
|
||||
wait: {},
|
||||
disabled: false,
|
||||
|
@ -138,8 +138,11 @@
|
||||
event: 'click',
|
||||
componentId: 'router',
|
||||
method: {
|
||||
name: 'setIndex',
|
||||
parameters: '{{router.index + 1}}',
|
||||
name: 'setValue',
|
||||
parameters: {
|
||||
key: 'index',
|
||||
value: '{{router.index + 1}}',
|
||||
},
|
||||
},
|
||||
wait: {},
|
||||
disabled: false,
|
||||
@ -178,8 +181,11 @@
|
||||
event: 'click',
|
||||
componentId: 'router',
|
||||
method: {
|
||||
name: 'setIndex',
|
||||
parameters: '2',
|
||||
name: 'setValue',
|
||||
parameters: {
|
||||
key: 'index',
|
||||
value: '2',
|
||||
},
|
||||
},
|
||||
wait: {},
|
||||
disabled: false,
|
||||
|
@ -26,6 +26,7 @@ const useEventTrait: TraitImplementation<{
|
||||
if (disabled) {
|
||||
return;
|
||||
}
|
||||
console.log(event);
|
||||
apiService.send('uiMethod', {
|
||||
componentId: event.componentId,
|
||||
name: event.method.name,
|
||||
|
@ -5,6 +5,8 @@ import { stateStore } from '../../store';
|
||||
|
||||
const HasInitializedMap = new Map<string, boolean>();
|
||||
|
||||
type KeyValue = { key: string; value: unknown };
|
||||
|
||||
const useStateTrait: TraitImplementation<{
|
||||
key: Static<typeof KeyPropertySchema>;
|
||||
initialValue: Static<typeof InitialValuePropertySchema>;
|
||||
@ -17,10 +19,10 @@ const useStateTrait: TraitImplementation<{
|
||||
|
||||
const upperCaseKey = capitalizeFirstLetter(key);
|
||||
const methods = {
|
||||
[`set${upperCaseKey}`](value: unknown) {
|
||||
setValue({ key, value }: KeyValue) {
|
||||
mergeState({ [key]: value });
|
||||
},
|
||||
[`reset${upperCaseKey}`]() {
|
||||
resetValue({ key }: KeyValue) {
|
||||
mergeState({ [key]: initialValue });
|
||||
},
|
||||
};
|
||||
@ -62,7 +64,10 @@ export default {
|
||||
methods: [
|
||||
{
|
||||
name: 'setValue',
|
||||
parameters: Type.Any(),
|
||||
parameters: Type.Object({
|
||||
key: Type.String(),
|
||||
value: Type.Any(),
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: 'reset',
|
||||
|
Loading…
Reference in New Issue
Block a user