Overview< /h1>svelte-webchat is an example of macOs-like WeChat chat interface developed based on svelte3.x+svelteKit+sass+mescroll.js and other technologies, with a new Dock-style menu/frosted glass background blur effect.
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/fd8e0730-7db7-49bf-9221-ab4317c9e826.jpg)
Technology stack
- Framework technology: svelte^3.46.5+svelteKit
- Status management: svelte/store
- Pull down to refresh: mescroll.js
- Iconfont icon: Alibaba font icon library
- Custom scroll bar: svelte-scrollbar
- Custom pop-up window: svelte-layer< /li>
- sass/less preprocessing: sass^1.50.1+svelte-preprocess
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/3122445c-8b4b-4dc9-9cae-d4ec6baf0b0c.jpg)
Project Structure
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/72d3abdb-e18a-46fd-982e-a01a3e703fa3.jpg)
Preview
svelte-webchat is an example of macOs-like WeChat chat interface developed based on svelte3.x+svelteKit+sass+mescroll.js and other technologies, with a new Dock-style menu/frosted glass background blur effect.
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/fd8e0730-7db7-49bf-9221-ab4317c9e826.jpg)
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/3122445c-8b4b-4dc9-9cae-d4ec6baf0b0c.jpg)
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/72d3abdb-e18a-46fd-982e-a01a3e703fa3.jpg)
Svelte.js framework
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/bd54cdcf-072c-4809-8238-3bf5d7e0d9c7.jpg)
svelte.js A new front-end framework. No virtual DOM, fast response capability. start up to 58K+.
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/dc1dbab2-0c20-40ba-8e20-de0ad12a0d01.jpg)
It claims to be faster than Vue.js, the syntax is simpler, and the compilation/running speed is faster.
https://github.com/sveltejs/svelte
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/3da3e0e8-9f43-4085-a997-85ba8f63f4af.jpg)
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/4a7601be-1657-453d-a346-e285b11dcd10.jpg)
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/bdb8faee-2926-4ad2-aea8-0731e87f3cd7.jpg)
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/c8fdc476-9626-49f9-b2a7-bc5a96d1b597.jpg)
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/bee6555f-def4-4a02-be60-58f4d81a89e2.jpg)
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/fda10081-1140-4660-836e-2ff533482214.jpg)
svelte.config.js configuration
Configure some alias paths, sass precompilation and other functions.
import adapter from '@sveltejs/adapter-auto'import path from 'path'import SvelteProcess from 'svelte-preprocess'/** @type {import('@sveltejs/kit').Config} * /const config = { kit: { adapter: adapter(), vite: { resolve: { alias: { '@': path.resolve('./src'), '@assets': path.resolve('./ src/assets'), '@utils': path.resolve('./src/utils') } } } }, // Disable Svelte warning about unused CSS selectors (css-unused-selector) onwarn: (warning , handler) => { const { code, frame } = warning if (code === "css-unused-selector") return handler(warning) }, preprocess: SvelteProcess()}; export default config;
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/f3304031-a736-4e0f-9a72-27f6713bc8a0.jpg)
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/c692c4be-25d3-4f31-838b-23f3f073f2b9.jpg)
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/08934c99-f1c2-4af2-ac65-acba3a98a901.jpg)
svelte.js public layout template
Although svelte.js does not have a router in vue -view, but svelteKit provides a similar __layout.svelte template layout and __error.svelte error page.
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/f934623c-871b-4601-8306-04e4b30d87be.jpg)
<div class="sv__container flexbox flex-alignc flex-justifyc" style="--themeSkin: {$skin}"> <div class="sv__wrapper" class:maximize={$isWinMaximize }> {#if $userinfo} <div class="sv__board flexbox flex-col"> <!-- <div class="sv__topbar">topbar</div> --> < ;div class="sv__mainwrap flex1 flexbox"> <!-- <div class="sv__sidebar">sidebar</div> --> <Middle /> <div class=" sv__mainbx flex1 flexbox flex-col"> <Winbar /> <slot /> </div> </div> <Dock /> </div> {:else} <div class ="sv__board flexbox flex-col"> <div class="sv__mainwrap flex1 flexbox"> <slot /> </div> </div> {/if} </div></ div>
__error.svelte error page
<!-- //Svelte error page--><script context="module"> export function load({ error, status }) { return { props: { error, status } } }</script><script> import { goto } from '$app/navigation' export let status export let error function goBack() { // history.go(-1) goto('/') }< ;/script><svelte:head> <title>{status} Error!</title></svelte:head><div class="sv__scrollview flex1"> <div class="sv__page- error flexbox flex-col flex-alignc flex-justifyc"> <div class="sv__page-error-img"> <img src="404.png" alt="" /> </div> <div class="sv__page-error-content"> <div class="c-red fs-18">┗| {status} |┛ Page Error~~</div> <div class= "c-999 mt-10">{error.message}</div> <div class="sv__btn sv__btn-default" style="color:#40b3ff;height:32px;width:120px;" on: click={goBack}><i class="iconfont icon-arrL"></i> Back to homepage</div> </div> </div></div>
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/28674063-5366-40e1-980a-33acfde947b3.jpg)
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/3901ef83-cab0-4ddb-b91e-c237d6df7d57.jpg)
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/50422d1d-281e-467c-b968-e73abc2161ab.jpg)
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/0bfa39ff-f40c-4456-8564-c1904e5790d4.jpg)
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/5ab691c3-4743-403b-a052-2b098a18174b.jpg)
The entire project, including the pop-up window, uses a frosted glass background blur effect.
svelte.js custom components
The pop-up windows and scroll bars you see are all based on svelte.js self-defined components Define components to implement functionality.
svelte component series: svelte3.x custom pc terminal pop-up window component svelteLayer
svelte component series: svelte3 custom virtual scroll bar SvelteScrollbar
![](http://daogezhiyuan-article.oss-cn-beijing.aliyuncs.com/win3000/pic/7d2f1dd8-3788-4dbe-906d-18e08b234ba4.jpg)
Okay, use svelte.js to develop a desktop PC version of the chat example and share so much first.
Welcome friends to leave a message, exchange and discuss~~
Articles are uploaded by users and are for non-commercial browsing only. Posted by: Lomu, please indicate the source: https://www.daogebangong.com/en/articles/detail/sveltejs%20web%20version%20chat%20%20sveltesvelteKitsass%20imitation%20WeChat%20chat%20example.html
评论列表(196条)
测试