Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Yossapol
/
wds-react
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 4fc3c2c4
authored
Feb 22, 2019
by
jutawuth nantawan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update doc
1 parent
ae138ca6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
100 additions
and
9 deletions
README.md
README.md
View file @
4fc3c2c
...
...
@@ -268,19 +268,110 @@ export default class HomePage extends Component {
```
การตั้งชื่อ class
| | |
| --------- | ---- |
| Component | |
| Template | |
| Page | |
#### Class Component
ขึ้นต้นด้วย "WDS " ตามด้วย ชื่อของ Component ที่ขึ้นต้นด้วยตัวอักษรภาษาอังกฤษตัวพิมพ์
<u>
ใหญ่
</u>
เฉพาะตัวอักษรตัวแรก
คั่นระหว่างคำด้วยตัวอักษรภาษาอังกฤษตัวพิมพ์
<u>
ใหญ่
</u>
เฉพาะตัวอักษรตัวแรก
ตามด้วยตัวอักษรภาษาอังกฤษตัวพิมพ์
<u>
เล็ก
</u>
ตามด้วยคำว่า "Component"
```
javascript
import
React
,
{
Component
,
Fragment
}
from
'react'
;
import
{
Input
,
Icon
}
from
'antd'
;
export
default
class
WDSUsernameTextfieldComponent
extends
Component
{
render
()
{
return
(
<
Input
prefix
=
{
<
Icon
type
=
"user"
style
=
{{
color
:
'rgba(0,0,0,.25)'
}}
/>} placeholder="Username" /
>
);
}
}
```
#### Class Template
ขึ้นต้นด้วย "WDS " ตามด้วย ชื่อของ Template ที่ขึ้นต้นด้วยตัวอักษรภาษาอังกฤษตัวพิมพ์
<u>
ใหญ่
</u>
เฉพาะตัวอักษรตัวแรก
คั่นระหว่างคำด้วยตัวอักษรภาษาอังกฤษตัวพิมพ์
<u>
ใหญ่
</u>
เฉพาะตัวอักษรตัวแรก
ตามด้วยตัวอักษรภาษาอังกฤษตัวพิมพ์
<u>
เล็ก
</u>
ตามด้วยคำว่า "Template"
```
javascript
import
React
,
{
Component
}
from
'react'
;
import
{
Layout
}
from
'antd'
;
import
*
as
EventConstants
from
'../../../resources/js/constants/eventConstants'
;
import
{
style
}
from
'./resources/style/jsx/footerStyle'
;
const
{
Footer
}
=
Layout
;
export
default
class
WDSFooterTemplate
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
systemFooter
:
''
};
}
render
()
{
return
<
Footer
style
=
{
style
}
>
{
this
.
state
.
systemFooter
}
<
/Footer>
;
}
}
```
#### Class Page
ขึ้นต้นด้วยตัวอักษรภาษาอังกฤษตัวพิมพ์
<u>
ใหญ่
</u>
เฉพาะตัวอักษรตัวแรก
ตามด้วยตัวอักษรภาษาอังกฤษตัวพิมพ์
<u>
เล็ก
</u>
ตามด้วยคำว่า "Page"
```
javascript
import
React
from
'react'
;
import
Axios
from
'axios'
;
import
Login
from
'../../templates/form/login/Login'
;
import
history
from
'../../history'
;
import
*
as
UrlConstants
from
'../../resources/js/constants/urlConstants'
;
import
Logo
from
'./resources/images/logo_login.png'
;
import
'./resources/style/css/login.css'
;
export
default
class
LoginPage
extends
React
.
Component
{
_login
=
async
params
=>
{
const
results
=
await
Axios
.
post
(
UrlConstants
.
URL_LOGIN
,
params
);
if
(
results
.
data
.
success
)
{
history
.
push
(
'/process'
);
}
};
render
()
{
return
(
<
div
className
=
"login"
>
<
img
src
=
{
Logo
}
className
=
"login-logo"
alt
=
"logo"
/>
<
br
/>
<
br
/>
<
br
/>
<
Login
getFormSubmitFn
=
{
this
.
_login
}
/
>
<
/div
>
);
}
}
```
-
Component
-
Template
-
Page
### Import
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment