Skip to content

Commit

Permalink
实现编译 template 成 render 函数
Browse files Browse the repository at this point in the history
  • Loading branch information
jindy committed Jun 28, 2022
1 parent c13829e commit 6fb5575
Show file tree
Hide file tree
Showing 14 changed files with 1,098 additions and 16 deletions.
13 changes: 13 additions & 0 deletions example/CompilerBase/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { ref } from "../../lib/guide-mini-vue.esm.js";

export const App = {
name: "App",
template: `<div>hi,{{count}}</div>`,
setup() {
const count = (window.count = ref(1));
return {
count,
message: 'mini-vue'
};
},
};
25 changes: 25 additions & 0 deletions example/CompilerBase/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
.red {
color: red;
}

.blue {
color: blue;
}
</style>
</head>

<body>
<div id="app"></div>
<script src="main.js" type="module"></script>
</body>

</html>
5 changes: 5 additions & 0 deletions example/CompilerBase/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { createApp } from "../../lib/guide-mini-vue.esm.js";
import { App } from "./App.js";

const rootContainer = document.querySelector("#app");
createApp(App).mount(rootContainer);
Loading

0 comments on commit 6fb5575

Please sign in to comment.