Overview of unisave template
.vue files immediately without manual configuration, drawing inspiration from the vitesse template. It focuses on embracing the open npm ecosystem and tools like VS Code and pnpm over proprietary environments.website·Indexed 31 days ago
https://blog.sunpm.meAn open-source template based on Vue 3 and uni-app for creating type-safe, high-performance, and production-grade cross-platform applications. The documentation covers installation, state management with Pinia, data fetching using @uni-helper/uni-network, styling with UnoCSS, and UI component library integration.
.vue files immediately without manual configuration, drawing inspiration from the vitesse template. It focuses on embracing the open npm ecosystem and tools like VS Code and pnpm over proprietary environments.To produce the /i/ sound, follow these mouth positioning steps:
@scroll event to update scrollTop in a uni-app scroll-view, the high frequency of function calls can cause page jitter. Implementing a debounce function ensures that the update logic only executes after a specified period of inactivity, reducing the number of DOM updates.// Debounce utility function
function debounce(func, wait = 500) {
if (timeout !== null) clearTimeout(timeout);
timeout = setTimeout(() => {
typeof func === 'function' && func();
}, wait);
}
// Vue component implementation
<template>
<scroll-view :scroll-top="scrollTop" @scroll="scroll">
<view>Content</view>
</scroll-view>
</template>
<script>
export default {
data() {
return {
scrollTop: 0,
}
},
methods: {
scroll(e) {
// Use bind to maintain 'this' context and pass the event object
debounce(this.updateScrollTop.bind(this, e));
},
updateScrollTop(e) {
this.scrollTop = e.detail.scrollTop;
},
goTop() {
this.scrollTop = 0;
}
}
}
</script>To develop an intuitive sense of pronunciation and rhythm, use the following active practice methods:
pinia-plugin-persist-uni to handle data persistence specifically for uniapp environments. State is managed using the Composition API approach.import { defineStore } from 'pinia'
import { ref } from 'vue'
export const useCountStore = defineStore('count', () => {
const count = ref(0)
function inc() {
count.value += 1
}
function dec() {
count.value -= 1
}
return {
count,
inc,
dec,
}
}, {
persist: {
enabled: true,
detached: true, // Detach subscription from component
},
})
vue add command. During the installation process, you will be prompted to select a configuration style (e.g., Prettier, Airbnb, Standard) and additional linting features such as 'Lint on save'. Once configured, the CLI automatically installs the necessary dependencies, creates the configuration files, and formats the existing project code.vue add @vue/eslintWhen a function is imported from a module (or a third-party library) but its parameter and return types are not explicitly exported, you can use the Parameters<T> and ReturnType<T> utility types to derive them.
Because these utility types expect a function type rather than the function implementation itself, you must use the typeof operator to get the type of the function.
Parameters<typeof func> returns a tuple containing all the parameter types of the function. To get a specific parameter, access it via an index (e.g., [0] for the first parameter).ReturnType<typeof func> returns the type of the value returned by the function.// Example function where types are NOT exported
export function login(param: { username: string; password: string }) {
return { token: 'token' };
}
// --- In another file ---
import { login } from './login';
// 1. Extract the type of the first parameter
const userInfo: Parameters<typeof login>[0] = {
username: 'admin',
password: '123'
};
// 2. Extract the return type of the function
const userResult: ReturnType<typeof login> = login(userInfo);addImageBlobHook event handler and add a new listener that processes the image blob and returns the resulting URL via the callback.this.editor.eventEmitter.removeEventHandler('addImageBlobHook') // Remove default listener
// Add custom upload logic
this.editor.eventEmitter.listen('addImageBlobHook', (blob, callback) => {
// Replace this.upload with your actual upload function
this.upload(blob, (url) => {
callback(url)
})
})To produce the /e/ sound, follow these articulation steps:
Consonants should be tackled in groups using specific physical tests to ensure correct articulation:
| Group | Key Symbols | Training Tool/Method |
|---|---|---|
| Plosives | /p/ /b/ /t/ /d/ /k/ /g/ | Tissue Test: Hold a tissue in front of the mouth; it should move when pronouncing /p/. |
| Fricatives | /f/ /v/ /θ/ /ð/ /s/ /z/ | Tongue Feel: For /θ/, the tip of the tongue must be between the teeth. |
| Affricates | /tʃ/ /dʒ/ /tr/ /dr/ | Contrast: Compare the tongue position of the Chinese sound "chi" with /tʃ/. |
| Nasals | /m/ /n/ /ŋ/ | Nose Pinch: Pinch the nose while pronouncing /m/; the sound should be blocked. |
easycom for automatic component registration, eliminating the need for manual imports and registration in every page.pnpm add wot-design-uniUpdate pages.config.ts. Note: If you have other easycom rules, merge them into a single easycom field.
{
"easycom": {
"autoscan": true,
"custom": {
"^wd-(.*)": "wot-design-uni/components/wd-$1/wd-$1.vue"
}
},
"pages": [ ... ]
}Update tsconfig.json to include global component types:
{
"compilerOptions": {
"types": ["wot-design-uni/global"]
}
}To produce the /ɪ/ sound, follow these physical articulation steps: