随笔分类 -  vue2

摘要:https://www.cnblogs.com/chyingp/p/websocket-deep-in.html 阅读全文 »
posted @ 2024-01-02 11:44 文采呱呱 阅读(5) 评论(0) 推荐(0) 编辑
摘要:<template> <custom-card shadow="hover" bordered> <div class="system-search"> <div class="search-box"> <el-input class="box-input" placeholder="请输入门店/编 阅读全文 »
posted @ 2023-10-18 16:23 文采呱呱 阅读(10) 评论(0) 推荐(0) 编辑
摘要: 阅读全文 »
posted @ 2023-04-29 15:19 文采呱呱 阅读(5) 评论(0) 推荐(0) 编辑
摘要:App.vue <keep-alive include="Home"> <router-view /> </keep-alive> router index.js import Vue from 'vue' import VueRouter from 'vue-router' import Home 阅读全文 »
posted @ 2023-01-03 16:44 文采呱呱 阅读(85) 评论(0) 推荐(0) 编辑
摘要:main.js // 导入安装vant组件库 import Vant from 'vant'; // 为了覆盖默认的less变量,需要把css后缀名改为less import 'vant/lib/index.less'; Vue.use(Vant); vue.config.js const { de 阅读全文 »
posted @ 2023-01-03 11:43 文采呱呱 阅读(198) 评论(0) 推荐(0) 编辑
摘要:app.js: <template> <div id="app"> <router-view></router-view> </div> </template> <style lang="less"> body, html { margin: 0; padding: 0; height: 100%; 阅读全文 »
posted @ 2023-01-02 10:37 文采呱呱 阅读(17) 评论(0) 推荐(0) 编辑
摘要:用户点击了页面的路由链接,会导致hash值发生变化,路由监听到hash值的链接发生的变化,会把对应的组件渲染到当前的页面中 安装: 直接安装router的话会安装最新版的,最新版仅支持vue3,安装后报错的请检查一下自己的npm版本是否过高 npm i vue-router@3.5.2 -S ind 阅读全文 »
posted @ 2022-12-17 15:01 文采呱呱 阅读(98) 评论(0) 推荐(0) 编辑
摘要:// 在方法的形参()之前,是否加上空格 "space-before-function-paren": ["warn", "never"], // 组件名字检测 "vue/multi-word-component-names": "off", // 关闭空格检测 "indent": 0 阅读全文 »
posted @ 2022-12-15 15:16 文采呱呱 阅读(41) 评论(0) 推荐(0) 编辑
摘要:<p v-color="'red'">测试</p> <button @click="color = 'green'">改变 color 的颜色值</button> data() { return { color: 'blue' } }, // 私有自定义指令的节点 directives: { // 阅读全文 »
posted @ 2022-12-14 17:00 文采呱呱 阅读(157) 评论(0) 推荐(0) 编辑
摘要:main: import Vue from 'vue' import App from './App.vue' // vant import Vant from 'vant'; import 'vant/lib/index.css'; import { NavBar,SubmitBar,Card,C 阅读全文 »
posted @ 2022-12-09 18:34 文采呱呱 阅读(15) 评论(0) 推荐(0) 编辑
摘要:vue 官方规定:每一个 slot 插槽,都要有一个 name 名称 如果省略了 slot 的 name 属性,则有一个默认名称叫做 default 组件中使用:<slot name="default"> <h6>这是 default 插槽的后备内容</h6> </slot>省略后: <slot> 阅读全文 »
posted @ 2022-12-08 16:26 文采呱呱 阅读(90) 评论(0) 推荐(0) 编辑
摘要:<template> <div class="app-container"> <h1>App 根组件</h1> <hr /> <button @click="comName = 'Left'">展示 Left</button> <button @click="comName = 'Right'">展 阅读全文 »
posted @ 2022-12-06 15:42 文采呱呱 阅读(99) 评论(0) 推荐(0) 编辑
摘要:some: return true是固定写法,终止some循环 erver: filter: 优化写法: arr.filter(item=>item.state).reduce((累加的结果,当前循环项)=>{},初始值)拿上面的arr优化写法示例:arr.filter(item=>item.sta 阅读全文 »
posted @ 2022-12-01 17:51 文采呱呱 阅读(67) 评论(0) 推荐(0) 编辑
摘要:在vue中不建议安装jquery 在vue中操控dom可以用ref方法 每一个ref对象中都包含一个$refs对象,组件的$refs对象都指向一个空对象 <button @click="clg" class="red">打印</button> methods: { clg(){ console.lo 阅读全文 »
posted @ 2022-11-29 17:07 文采呱呱 阅读(103) 评论(0) 推荐(0) 编辑
摘要:父子组件: 父只管定义数据和传数据 子只管接收数据和声明数据 父:<hello :msg="message" :user="username"></hello> import hello from '@/components/HelloWorld.vue' data() { return { use 阅读全文 »
posted @ 2022-11-28 16:30 文采呱呱 阅读(34) 评论(0) 推荐(0) 编辑
摘要:生命周期: 生命周期 (Life Cycle) 是指一个组件从创建 -> 运行-> 销毁的整个阶段,强调的是一个时间段 创建阶段: beforeCreate:创建之前 created:创建 beforeMount:安装前 mounted:安装 运行阶段: beforeUpdate:更新之前 updg 阅读全文 »
posted @ 2022-11-25 17:48 文采呱呱 阅读(103) 评论(0) 推荐(0) 编辑
摘要:添加一个scoped<style scoped lang="less"> /deep/ 一般是第三方组件用比较多 使用前.red[data-v-7ba5bd90] 使用deep会影响本页面其他的父元素样式,包括组件 使用后 [data-v-7ba5bd90] .red 阅读全文 »
posted @ 2022-11-25 17:31 文采呱呱 阅读(181) 评论(0) 推荐(0) 编辑
摘要:在vue中,this就是实例对象 组件被封装后是独立的,使用后才有父子关系 <template> <div> <div> <input type="text" v-model="username"> <button @click="changName" class="red">数据</button> 阅读全文 »
posted @ 2022-11-25 17:08 文采呱呱 阅读(751) 评论(0) 推荐(0) 编辑
摘要:设置全局的cli输入命令: vue i -g @vue/cli快速生成工程化项目:vue create 项目名 create后,选择最后一个自定义选择 第一个必选 第二个是TS 第三个是渐进式框架 第四个是路由 第五个是vuex 第六个是css预处理器 第七个Linter / Formatter是约 阅读全文 »
posted @ 2022-11-24 16:53 文采呱呱 阅读(689) 评论(0) 推荐(0) 编辑
摘要:安装一个axios的包: npm i axios -S 安装完后引入: import axios from 'axios' axios:专注发起网络请求的库 get传参要params,post传参用data,具体传参看后端怎么写,后端乱写就套麻袋打一顿 post请求 简化版: 不用await和asy 阅读全文 »
posted @ 2022-11-22 18:03 文采呱呱 阅读(522) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示