-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4d7d606
commit cfc4053
Showing
12 changed files
with
2,190 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
.DS_Store | ||
dist | ||
*.local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<link rel="icon" href="/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Vite App</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "micro-juejin-tryVite", | ||
"version": "0.0.0", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build" | ||
}, | ||
"dependencies": { | ||
"vue": "^3.0.0-rc.1" | ||
}, | ||
"devDependencies": { | ||
"vite": "^1.0.0-rc.1", | ||
"@vue/compiler-sfc": "^3.0.0-rc.1" | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<template> | ||
<img alt="Vue logo" src="./assets/logo.png" /> | ||
<HelloWorld msg="Hello Vue 3.0 + Vite" /> | ||
</template> | ||
|
||
<script> | ||
import HelloWorld from './components/HelloWorld.vue' | ||
export default { | ||
name: 'App', | ||
components: { | ||
HelloWorld | ||
} | ||
} | ||
</script> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<template> | ||
<h1>{{ msg }}</h1> | ||
<button @click="count++">count is: {{ count }}</button> | ||
<p>Edit <code>components/HelloWorld.vue</code> to test hot module replacement.</p> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'HelloWorld', | ||
props: { | ||
msg: String | ||
}, | ||
data() { | ||
return { | ||
count: 0 | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#app { | ||
font-family: Avenir, Helvetica, Arial, sans-serif; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
text-align: center; | ||
color: #2c3e50; | ||
margin-top: 60px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { createApp } from 'vue' | ||
import App from './App.vue' | ||
import "./index.css" | ||
|
||
// import "./public-path"; | ||
|
||
|
||
let vm = null; | ||
|
||
|
||
async function VueRender(props = {}) { | ||
const { container } = props; | ||
vm = await createApp(App).mount(container ? container.querySelector("#app") : "#app") | ||
return Promise.resolve() | ||
} | ||
|
||
/*如果不作为微应用加载则直接调用VueRender*/ | ||
if (!window.__POWERED_BY_QIANKUN__) { | ||
VueRender().then(()=>{ | ||
console.log('作为非微应用加载') | ||
}); | ||
} | ||
|
||
(global => { | ||
global['purehtml'] = { | ||
bootstrap: () => { | ||
console.log('Vite App bootstrap'); | ||
return Promise.resolve(); | ||
}, | ||
mount: (props) => { | ||
console.log('Vite App mount'); | ||
return VueRender(props); | ||
}, | ||
unmount: () => { | ||
console.log('Vite App unmount'); | ||
return Promise.resolve(); | ||
}, | ||
}; | ||
})(window); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const port = 8076 | ||
|
||
export default { | ||
port, | ||
base: '//localhost:3000/', | ||
rollupOutputOptions:{ | ||
// name:'try-vite' | ||
} | ||
} |
Oops, something went wrong.