docs: 更新demo

This commit is contained in:
wanchun 2023-03-14 14:07:37 +08:00
parent 16c4264707
commit 425a04568b
9 changed files with 9 additions and 191 deletions

View File

@ -41,7 +41,7 @@ export default defineBuildConfig({
layout: { layout: {
title: 'Fes.js', title: 'Fes.js',
footer: 'Created by MumbleFE', footer: 'Created by MumbleFE',
multiTabs: true, multiTabs: false,
navigation: 'side', navigation: 'side',
theme: 'dark', theme: 'dark',
menus: [ menus: [
@ -50,9 +50,6 @@ export default defineBuildConfig({
icon: '/wine-outline.svg', icon: '/wine-outline.svg',
match: ['/route/*'], match: ['/route/*'],
}, },
{
name: 'store',
},
{ {
name: 'editor', name: 'editor',
icon: '/wine-outline.svg', icon: '/wine-outline.svg',

View File

@ -58,7 +58,6 @@
"@fesjs/plugin-qiankun": "^3.0.0-rc.0", "@fesjs/plugin-qiankun": "^3.0.0-rc.0",
"@fesjs/plugin-request": "^3.0.0-rc.0", "@fesjs/plugin-request": "^3.0.0-rc.0",
"@fesjs/plugin-sass": "^3.0.0-rc.0", "@fesjs/plugin-sass": "^3.0.0-rc.0",
"@fesjs/plugin-vuex": "^3.0.0-rc.0",
"@fesjs/plugin-watermark": "^3.0.0-rc.0", "@fesjs/plugin-watermark": "^3.0.0-rc.0",
"@fesjs/plugin-windicss": "^3.0.0-rc.0", "@fesjs/plugin-windicss": "^3.0.0-rc.0",
"@fesjs/plugin-swc": "^3.0.0-rc.0", "@fesjs/plugin-swc": "^3.0.0-rc.0",

View File

@ -19,12 +19,6 @@ export const beforeRender = {
}, },
}; };
// export const login = {
// hasLogin() {
// return !!sessionStorage.getItem('login');
// },
// };
export const layout = (layoutConfig, { initialState }) => ({ export const layout = (layoutConfig, { initialState }) => ({
...layoutConfig, ...layoutConfig,
renderCustom: () => <UserCenter />, renderCustom: () => <UserCenter />,

View File

@ -1,12 +1,12 @@
<template> <template>
<div class="page bg-black"> <div class="page">
home home
<FButton class="m-2">Button</FButton> <FButton class="m-2" @click="go">Button</FButton>
</div> </div>
</template> </template>
<script setup> <script setup>
import { defineRouteMeta } from '@fesjs/fes'; import { defineRouteMeta, useRouter } from '@fesjs/fes';
import { FButton } from '@fesjs/fes-design'; import { FButton } from '@fesjs/fes-design';
defineRouteMeta({ defineRouteMeta({
@ -14,6 +14,11 @@ defineRouteMeta({
title: '$home', title: '$home',
}); });
console.log('123123'.replaceAll('123', '234')); console.log('123123'.replaceAll('123', '234'));
const router = useRouter();
const go = () => {
router.push('/editor');
};
</script> </script>
<style> <style>

View File

@ -1,74 +0,0 @@
<template>
<div class="page">
<h4>Vuex</h4>
<input />
<div>
<button @click="increment">click me{{ doubleCount }}</button>
</div>
<div>
<button :disabled="disabled" @click="login">async login</button>
</div>
<div>
<button @click="fooBarIncrement">foo/bar{{ fooBarDoubleCount }}</button>
</div>
<div>{{ address }}</div>
</div>
</template>
<config>
{
"name": "store",
"title": "$store",
"keep-alive": true
}
</config>
<script>
import { computed, ref, onMounted, onUnmounted, onActivated, onDeactivated } from 'vue';
import { useStore } from 'vuex';
import { MUTATION_TYPES, GETTER_TYPES, ACTION_TYPES } from '@fesjs/fes';
export default {
setup() {
console.log('store.vue');
const store = useStore();
console.log('store==>', store);
const disabled = ref(false);
onMounted(() => {
console.log('onMounted');
});
onUnmounted(() => {
console.log('onUnmounted');
});
onActivated(() => {
console.log('onActivated');
});
onDeactivated(() => {
console.log('onDeactivated');
});
return {
address: computed(() => store.getters[GETTER_TYPES.user.address]),
doubleCount: computed(() => store.getters[GETTER_TYPES.counter.doubleCount]),
disabled,
increment: () => store.commit(MUTATION_TYPES.counter.increment),
login: () => {
disabled.value = true;
store.dispatch(ACTION_TYPES.user.login).then((res) => {
// eslint-disable-next-line no-alert
window.alert(res);
disabled.value = false;
});
},
fooBarIncrement: () => store.commit(MUTATION_TYPES.fooBar.increment),
fooBarDoubleCount: computed(() => store.getters[GETTER_TYPES.fooBar.doubleCount]),
};
},
};
</script>
<style scoped>
.page {
}
</style>

View File

@ -1,23 +0,0 @@
export default {
namespaced: true,
state: () => ({
count: 0
}),
mutations: {
increment(state) {
state.count++;
}
},
getters: {
doubleCount(state) {
return state.count * 2;
}
},
actions: {
asyncIncrement({ commit }) {
setTimeout(() => {
commit('increment');
}, 2000);
}
}
};

View File

@ -1,23 +0,0 @@
export default {
namespaced: true,
state: () => ({
count: 0
}),
mutations: {
increment(state) {
state.count++;
}
},
getters: {
doubleCount(state) {
return state.count * 2;
}
},
actions: {
asyncIncrement({ commit }) {
setTimeout(() => {
commit('increment');
}, 2000);
}
}
};

View File

@ -1,3 +0,0 @@
import { createLogger } from 'vuex';
export default createLogger();

View File

@ -1,54 +0,0 @@
export default {
namespaced: true,
state: () => ({
name: 'aring',
age: 20,
count: 0
}),
mutations: {
increment(state) {
state.count++;
}
},
getters: {
doubleCount(state) {
return state.count * 2;
}
},
actions: {
asyncIncrement({ commit }) {
setTimeout(() => {
commit('increment');
}, 2000);
},
login() {
return new Promise((reslove) => {
setTimeout(() => {
console.log('login');
reslove('OK');
}, 1000);
});
}
},
modules: {
address: {
state: () => ({
province: '广东省',
city: '深圳市',
zone: '南山区'
}),
getters: {
address(state) {
return state.province + state.city + state.zone;
}
}
},
posts: {
namespaced: true,
state: () => ({}),
mutations: {
doSomething() {}
}
}
}
};