Skip to content

Commit 39c4b56

Browse files
authored
fix component
1 parent bd95f79 commit 39c4b56

File tree

5 files changed

+112
-2
lines changed

5 files changed

+112
-2
lines changed

Elroid-Example/example-component.html

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<title>Elroid Example</title>
7+
<script src="Elroid.js"></script>
8+
</head>
9+
10+
<body>
11+
<div id="app"></div>
12+
13+
<script>
14+
const component = new ElComponent({
15+
template: `
16+
<h2>{{title}}</h2>
17+
<p>Users, {{name.1}} and {{name.2}}!</p>
18+
<p>Admin is, Name: {{name.3.name}} and Email {{name.3.email}}!</p>
19+
<button el-click="Edit">Edit Tilte</button>
20+
`,
21+
el: "#app",
22+
data: {
23+
name: {
24+
1: "Hossein",
25+
2: "Ali",
26+
3: {
27+
name: "Reza",
28+
29+
}
30+
},
31+
title: 'Custom Component',
32+
methods: {
33+
Edit() {
34+
component.update({ title: "Home" });
35+
}
36+
}
37+
},
38+
});
39+
40+
</script>
41+
</body>
42+
43+
</html>

Elroid-Example/example-html-edit.html

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<title>Elroid Example</title>
7+
<script src="Elroid.js"></script>
8+
</head>
9+
10+
<body>
11+
<div id="app">
12+
<h1>{{title}}</h1>
13+
<button el-click="Edit">Edit Tilte</button>
14+
<button el-click="Defult">Defult</button>
15+
</div>
16+
17+
<script>
18+
const app = new Elroid({
19+
el: '#app',
20+
data: {
21+
title: 'Welcome to Elroid Library',
22+
methods: {
23+
Edit() {
24+
app.update({ title: "Home" });
25+
},
26+
Defult() {
27+
app.update({ title: 'Welcome to Elroid Library' });
28+
}
29+
}
30+
}
31+
});
32+
</script>
33+
</body>
34+
35+
</html>

Elroid-Example/example.html

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<title>Elroid Example</title>
7+
<script src="Elroid.js"></script>
8+
</head>
9+
10+
<body>
11+
<div id="app">
12+
<h1>{{title}}</h1>
13+
<button el-click="ShowAlert">Click me</button>
14+
</div>
15+
16+
<script>
17+
const app = new Elroid({
18+
el: '#app',
19+
data: {
20+
name: 'Hossein',
21+
title: 'Welcome to Elroid Library',
22+
methods: {
23+
ShowAlert() {
24+
alert('Button clicked!');
25+
}
26+
}
27+
}
28+
});
29+
</script>
30+
</body>
31+
32+
</html>

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ Each html file in this repository is an example.
77
## Contact the developer
88
[Telegram](https://t.me/h3dev)
99
<br><br>
10-
[Email](mailto:[email protected])
10+
[Email](mailto:[email protected])

0 commit comments

Comments
 (0)