摘要: package mainimport "fmt"func main() { var a = "initial" fmt.Println(a) var b, c int = 1, 2 fmt.Println(b, c) var d = true fmt.Println(d) var e int fmt 阅读全文
posted @ 2026-05-02 17:37 学无边涯 阅读(4) 评论(0) 推荐(0)
摘要: Sscanf:字符串 → 变量(解析/提取) Sprintf:变量 → 字符串(格式化/生成) package main import "fmt" func main() { // Sscanf:解析(字符串 → 变量) var name string var age int str := "www 阅读全文
posted @ 2026-04-30 15:24 学无边涯 阅读(2) 评论(0) 推荐(0)
摘要: 模块(module) 一个 .py 文件就是一个模块 里面可以放函数、类、变量 例子:utils.py def add(a, b): return a + b 使用: import utilsutils.add(1, 2) 或: from utils import addadd(1, 2) 包(pa 阅读全文
posted @ 2026-02-24 17:17 学无边涯 阅读(6) 评论(0) 推荐(0)
摘要: 1. v-if原理:v-if 是 条件渲染,会根据条件判断来 动态地销毁和重建 DOM 元素。 性能:当条件为 false 时,v-if 会完全移除该元素及其所有子元素;当条件变为 true 时,它会重新渲染这个元素。适用于切换条件较少的场景,或者当切换频繁时不太重要。 使用场景: 当某些内容需要根 阅读全文
posted @ 2025-12-29 11:41 学无边涯 阅读(12) 评论(0) 推荐(0)
摘要: <div>{{num}}</div> <button @click="add">++</button> <script>import SaleCard from "../../components/SaleCard.vue";import { mapState,mapActions } from ' 阅读全文
posted @ 2025-12-27 14:31 学无边涯 阅读(6) 评论(0) 推荐(0)
摘要: <div>{{num}}</div> <button @click="add">++</button> <script>import { mapState, mapMutations } from "vuex";export default { name: 'HomeIndex', componen 阅读全文
posted @ 2025-12-27 14:13 学无边涯 阅读(8) 评论(0) 推荐(0)
摘要: 1,组件直接用 <div>{{$store.getters.doubleNum}}</div> 2, 计算属性用法 <div>{{doubleNum}}</div> computed:{ doubleNum(){ return this.$store.getters.doubleNum } } 3, 阅读全文
posted @ 2025-12-27 13:45 学无边涯 阅读(10) 评论(0) 推荐(0)
摘要: 1,组件直接用法 <div>{{$store.state.num}}</div> 2,计算属性里面用法 <div>{{num}}</div> computed:{ num(){ return this.$store.state.num } } 3,用mapState <div>{{num}}</di 阅读全文
posted @ 2025-12-27 13:41 学无边涯 阅读(7) 评论(0) 推荐(0)
摘要: import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) const store = new Vuex.Store({ state:{ num:11 }, getters:{ }, mutations:{ }, actions:{ } } 阅读全文
posted @ 2025-12-27 13:28 学无边涯 阅读(8) 评论(0) 推荐(0)
摘要: 1,params(路径参数 /user/:id) { path: '/product/:id', name: 'productDetail', component: ProductDetail } router.push({ name: 'productDetail', params: { id: 阅读全文
posted @ 2025-12-26 16:35 学无边涯 阅读(4) 评论(0) 推荐(0)