master
yutent 2023-03-25 23:23:17 +08:00
commit 59157e181b
14 changed files with 276 additions and 0 deletions

16
.gitignore vendored Normal file
View File

@ -0,0 +1,16 @@
dist
node_modules
*.sublime-project
*.sublime-workspace
package-lock.json
._*
.Spotlight-V100
.Trashes
.DS_Store
.AppleDouble
.LSOverride

11
.prettierrc.yaml Normal file
View File

@ -0,0 +1,11 @@
jsxBracketSameLine: true
jsxSingleQuote: true
semi: false
singleQuote: true
printWidth: 80
useTabs: false
tabWidth: 2
trailingComma: none
bracketSpacing: true
arrowParens: avoid

18
index.html Normal file
View File

@ -0,0 +1,18 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<title>{{title}}</title>
<meta name="keywords" content="{{keywords}}">
<meta name="description" content="{{description}}">
<link rel="stylesheet" href="//jscdn.ink/@bytedo/wcui/1.0.12/css/reset-basic.css">
<script async src="//jscdn.ink/es-module-shims/1.6.3/es-module-shims.wasm.js"></script>
<script type="importmap">{{importmap}}</script>
</head>
<body>
<div class="app noselect"></div>
<script src="main.js"></script>
</body>
</html>

11
package.json Normal file
View File

@ -0,0 +1,11 @@
{
"name": "fite-app",
"type": "module",
"scripts": {
"start": "fite dev",
"build": "fite build"
},
"devDependencies": {
"fite": "^0.4.0"
}
}

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

63
src/app.vue Normal file
View File

@ -0,0 +1,63 @@
<template>
<header>
<img alt="Vue logo" class="logo" src="/assets/logo.svg" width="125" height="125" />
<div class="wrapper">
<Hello msg="It works!!!" />
<nav>
<router-link to="/">Home</router-link>
<router-link to="/about">About</router-link>
</nav>
</div>
</header>
<router-view />
</template>
<script>
import Hello from './components/hello.vue'
export default {
components: { Hello }
}
</script>
<style lang="scss">
.app {
padding: 16px;
}
header {
display: flex;
flex-direction: column;
align-items: center;
}
a {
color: var(--color-teal-1);
transition: 0.2s;
}
a:hover {
color: var(--color-teal-3);
}
nav {
margin-top: 32px;
display: flex;
justify-content: center;
a {
margin: 0 16px;
}
}
main {
margin: 32px;
text-align: center;
}
</style>

1
src/assets/logo.svg Normal file
View File

@ -0,0 +1 @@
<svg viewBox="0 0 261.76 226.69" xmlns="http://www.w3.org/2000/svg"><path d="M161.096.001l-30.225 52.351L100.647.001H-.005l130.877 226.688L261.749.001z" fill="#41b883"/><path d="M161.096.001l-30.225 52.351L100.647.001H52.346l78.526 136.01L209.398.001z" fill="#34495e"/><path d="M36.21 192.639l160.921-74.805-81.778-5.063 119.519-67.69L49.06 126.138l88.8 2.712z" fill="rgb(252, 118, 97)"/></svg>

After

Width:  |  Height:  |  Size: 394 B

40
src/components/hello.vue Normal file
View File

@ -0,0 +1,40 @@
<template>
<div class="greetings">
<h1 class="green">{{ msg }}</h1>
<h3>
你已经成功运行了一个项目, 项目基于
<a href="//github.com/bytedo/vue-live" target="_blank">Vue-live</a> +
<a href="//vuejs.org" target="_blank">Vue 3</a>.
</h3>
</div>
</template>
<script>
export default {
props: {
msg: String
}
}
</script>
<style>
h1 {
font-size: 52px;
}
h3 {
font-size: 1.2rem;
font-weight: normal;
}
.green {
font-family: 'Courier New', Courier, monospace;
color: var(--color-blue-1);
}
.greetings {
text-align: center;
}
</style>

11
src/main.js Normal file
View File

@ -0,0 +1,11 @@
import { createApp } from 'vue'
import App from './app.vue'
import router from './router'
import store from './store'
const app = createApp(App)
app.use(router).use(store).mount('.app')

23
src/router.js Normal file
View File

@ -0,0 +1,23 @@
import { createRouter, createWebHistory } from 'vue-router'
import Home from './views/home.vue'
const router = createRouter({
history: createWebHistory(),
routes: [
{
path: '/',
name: 'home',
component: Home
},
{
path: '/about',
name: 'about',
component: () => import('./views/about.vue')
}
]
})
export default router

11
src/store.js Normal file
View File

@ -0,0 +1,11 @@
import { reactive } from 'vue'
const store = reactive({
foo: 'bar',
version: '0.4.0'
})
export default function (app) {
app.config.globalProperties.$store = store
}

18
src/views/about.vue Normal file
View File

@ -0,0 +1,18 @@
<script>
export default {
data(){
return {
content: '这是关于我们页面'
}
}
}
</script>
<template>
<main>
<h1>{{content}}</h1>
<cite>当前vue-live版本: v{{$store.version}}</cite>
</main>
</template>

17
src/views/home.vue Normal file
View File

@ -0,0 +1,17 @@
<script>
export default {
data(){
return {
content: '欢迎访问~~ 这是首页'
}
}
}
</script>
<template>
<main>
<h1>{{content}}</h1>
</main>
</template>

36
vue.live.js Normal file
View File

@ -0,0 +1,36 @@
import { resolve } from 'path'
export default {
devServer: {
port: 8080,
domain: '',
https: false,
ssl: {
key: '',
cert: ''
// ca: ''
}
},
pages: {
// 如果多页应用, 则这里写传入多个值即可(注意不是数组格式)
// 这里的key值, 将是最终的页面的名称
index: {
// 这里的resolve可将相对路径转为绝对路径
// 如果传入的路径已经是绝对路径的, 可不需要resolve
entry: resolve('./src/main.js'),
title: 'vue-live 应用示例'
}
},
// 以下cdn地址, 可自行修改为适合的
// 有用到其他的库, 可以手动添加,
// 也可以在页面中直接引入完整的路径, 而不必须在这里声明
imports: {
vue: '//jscdn.ink/vue/3.2.47/vue.runtime.esm-browser.prod.js',
// 这个vue-router库, 移除了 @vue/devtools-api 相关的代码。 以达到减少不必须的体积的效果
// 如需要支持devtools的, 请修改为原版vue-router地址即可。
// 'vue-router': '//jscdn.ink/@bytedo/vue-router/4.1.6/vue-router.js',
// 'vue-router': '//jscdn.ink/vue-router/4.1.6/vue-router.esm-browser.js',
// '@vue/devtools-api': '//jscdn.ink/@vue/devtools-api/6.5.0/esm/index.js',
fetch: '//jscdn.ink/@bytedo/fetch/2.1.5/next.js'
}
}