This commit is contained in:
Karl Horky
2020-12-15 15:21:29 +01:00
committed by GitHub
parent aedd2ec3db
commit b8824141d6
+7 -7
View File
@@ -2,7 +2,7 @@
## Add a new layout
Take a new layout named `secondary` as an example to make the route starting with `seconday` use this layout.
Take a new layout named `secondary` as an example to make the route starting with `secondary` use this layout.
1. Add related configuration in `src/utils/config.js`. For details, please refer to [layouts](/configuration?id=layouts).
@@ -11,11 +11,11 @@ Take a new layout named `secondary` as an example to make the route starting wit
           {
               name: 'primary',
               include: [/.*/],
               exclude: [/(\/(en|zh))*\/login/, /(\/(en|zh))*\/seconday\/(.*)/],
               exclude: [/(\/(en|zh))*\/login/, /(\/(en|zh))*\/secondary\/(.*)/],
           },
           {
               name: 'secondary',
               include: [/(\/(en|zh))*\/seconday\/(.*)/],
               include: [/(\/(en|zh))*\/secondary\/(.*)/],
           },
   ],
```
@@ -40,21 +40,21 @@ Take a new layout named `secondary` as an example to make the route starting wit
   export default ({ children }) => {
     Return (
       <div>
         <h1>Seconday</h1>
         <h1>Secondary</h1>
         {children}
       </div>
     )
   }
```
4. Add a `seconday/index.js` file to the `src/pages/` directory.
4. Add a `secondary/index.js` file to the `src/pages/` directory.
```javascript
   import React from 'react'
   export default ({ children }) => {
     Return <div>Seconday page Content</div>
     Return <div>Secondary page Content</div>
   }
```
5. Finally, start the development mode `npm run start`, open [http://localhost:7000/seconday/](http://localhost:7000/seconday/) and you will see the page for the `seconday` layout.
5. Finally, start the development mode `npm run start`, open [http://localhost:7000/secondary/](http://localhost:7000/secondary/) and you will see the page for the `secondary` layout.