mirror of
				https://github.com/Tencent/tmagic-editor.git
				synced 2025-11-04 18:52:18 +08:00 
			
		
		
		
	refactor(editor): service中state改完使用shallowReactive
This commit is contained in:
		
							parent
							
								
									1bcefdb1e8
								
							
						
					
					
						commit
						552df3a614
					
				@ -16,14 +16,14 @@
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
import { reactive } from 'vue';
 | 
			
		||||
import { shallowReactive } from 'vue';
 | 
			
		||||
 | 
			
		||||
import type { ComponentGroup, ComponentGroupState } from '@editor/type';
 | 
			
		||||
 | 
			
		||||
import BaseService from './BaseService';
 | 
			
		||||
 | 
			
		||||
class ComponentList extends BaseService {
 | 
			
		||||
  private state = reactive<ComponentGroupState>({
 | 
			
		||||
  private state = shallowReactive<ComponentGroupState>({
 | 
			
		||||
    list: [],
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -15,7 +15,7 @@
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
import { reactive } from 'vue';
 | 
			
		||||
import { reactive, shallowReactive } from 'vue';
 | 
			
		||||
 | 
			
		||||
import type { DepExtendedData, Id, MNode, Target, TargetNode } from '@tmagic/core';
 | 
			
		||||
import { DepTargetType, Watcher } from '@tmagic/core';
 | 
			
		||||
@ -40,7 +40,7 @@ type StateKey = keyof State;
 | 
			
		||||
const idleTask = new IdleTask<{ node: TargetNode; deep: boolean; target: Target }>();
 | 
			
		||||
 | 
			
		||||
class Dep extends BaseService {
 | 
			
		||||
  private state = reactive<State>({
 | 
			
		||||
  private state = shallowReactive<State>({
 | 
			
		||||
    collecting: false,
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
import { reactive } from 'vue';
 | 
			
		||||
import { shallowReactive } from 'vue';
 | 
			
		||||
import type { Writable } from 'type-fest';
 | 
			
		||||
 | 
			
		||||
import StageCore from '@tmagic/stage';
 | 
			
		||||
@ -17,7 +17,7 @@ const canUsePluginMethods = {
 | 
			
		||||
type SyncMethodName = Writable<(typeof canUsePluginMethods)['sync']>;
 | 
			
		||||
 | 
			
		||||
class StageOverlay extends BaseService {
 | 
			
		||||
  private state: StageOverlayState = reactive({
 | 
			
		||||
  private state: StageOverlayState = shallowReactive({
 | 
			
		||||
    wrapDiv: document.createElement('div'),
 | 
			
		||||
    sourceEl: null,
 | 
			
		||||
    contentEl: null,
 | 
			
		||||
 | 
			
		||||
@ -16,7 +16,7 @@
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
import { reactive } from 'vue';
 | 
			
		||||
import { shallowReactive } from 'vue';
 | 
			
		||||
import type { Writable } from 'type-fest';
 | 
			
		||||
 | 
			
		||||
import { convertToNumber } from '@tmagic/utils';
 | 
			
		||||
@ -26,7 +26,7 @@ import type { AsyncHookPlugin, StageRect, UiState } from '@editor/type';
 | 
			
		||||
 | 
			
		||||
import BaseService from './BaseService';
 | 
			
		||||
 | 
			
		||||
const state = reactive<UiState>({
 | 
			
		||||
const state = shallowReactive<UiState>({
 | 
			
		||||
  uiSelectMode: false,
 | 
			
		||||
  showSrc: false,
 | 
			
		||||
  showStylePanel: true,
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user