# 04.项目路由方案

## 组件化之路:去模型化与路由

> 先吐槽下... 去年年底来到新公司, 公司项目代码有四五年了, 经手了十几号人. 规范什么的基本不存在, 耦合混乱, 垃圾奇葩代码遍地. 印象最深的是UI让改一个到处都有的一个样式的按钮的颜色. MMP改的我要死不活的...连基本的复用都不存在 过年前准备对项目进行组件化重构

## 目标

这次组件化方案需要解决的主要问题有两点 `解耦` 和 `取模型化`

## 去模型化

这里我采用的是使用 `NSDictionary` 来实现去模型化

### 使用模型有什么好处?

* 使用数据较为便捷
* 无须过多关心数据解析,交给第三方库即可

### 去模型话有什么好处?

* 解耦
* 极大减少项目文件数量

### 存在的问题

* `hardcode` 这是解耦去模型必然会出现的问题

## 解耦\_路由


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ryukiedev.gitbook.io/wiki/ios/za-xiang/xiang-mu-lu-you-fang-an.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
