vuex 模块初始化源码阅读

  • Post author:
  • Post category:vue

GitHub: https://github.com/vuejs/vuex/blob/dev/src/module/module-collection.js 首先看构造函数: constructor (rawRootModule) { // register root module (Vuex.Store options) this.register([], rawRootModule, fals…

继续阅读 vuex 模块初始化源码阅读

Vue状态管理 Storage Vuex Pinia

  • Post author:
  • Post category:vue

趁着周末编写Vue有关的状态管理插件 , 抛出三个方法 { Storage, createVuexPersistedState, createPiniaPersistedState } Storage 直接操作H5缓存特性 【window.sessionStorage,window.localStorage】 let s = new Storage({source:window.localStor…

继续阅读 Vue状态管理 Storage Vuex Pinia

Vue自定义的组件@click失效

  • Post author:
  • Post category:vue

Vue自定义的组件@click失效 错误示例 描述 正确示例 解释 错误示例 <template> <div> <Buttom text="确定" @click="handler()"></Buttom> <input type="button" @click="handler()" value="确定" /> </div> …

继续阅读 Vue自定义的组件@click失效

vue+ElementUI el-table表格新增一行或删除一行编辑组件(输入框,选择框,复选框)

  • Post author:
  • Post category:vue

此功能已集成在el-table二次封装组件中—— 地址 一、最终效果 二、组件功能点(只支持整行编辑) 1、数据化结构(减少html代码) 2、可编辑整行单元格(同时满足不同编辑形式——input、select、checkbox、date等) 3、可删除整行 三、参数配置 1、代码示例 <t-edit-table :table="table" :listTypeInfo="listTypeI…

继续阅读 vue+ElementUI el-table表格新增一行或删除一行编辑组件(输入框,选择框,复选框)

创建 VUE3.0 项目

  • Post author:
  • Post category:vue

通过 VUE CLI 创建一个简单的 VUE 项目 1.安装 Vue CLI 确保了各种构建工具能够基于智能的默认配置即可平稳衔接,致力于将 Vue 生态中的工具基础标准化。 安装命令 npm install -g @vue/cli 或者 yarn global add @vue/cli 升级全局的 Vue CLI 包 npm update -g @vue/cli 或者 yarn global u…

继续阅读 创建 VUE3.0 项目

前端 Vue中使用px2rem把px转换为rem

  • Post author:
  • Post category:vue

使用 Vue 做移动端页面时,适配是必须的,rem 不失为一种好的选择,可在不同屏幕上完美显示相同的布局px2rem 插件可以使 <style></style> 中的 px 单位根据设计稿转换为 rem 1.安装 2.配置 px2rem-loader 在 build/utils.js 的 15 行 export.assetsPath = function(_pth){...…

继续阅读 前端 Vue中使用px2rem把px转换为rem

vue create 报错

  • Post author:
  • Post category:vue

vue create 报错 解决方案:https://stackoverflow.com/questions/53934852/vue-cli-3-command-failed-npm-install-loglevel-error 需要注意文章中提供了两种主要解决方式: 1、 npm cache clean --force 或手动删除appdata文件夹下的npm-cache。 2、 npm co…

继续阅读 vue create 报错

vue框架—–点击按钮变色、选中按钮后字体变色

  • Post author:
  • Post category:vue

目录 按钮变色 html 初始化数据 方法 选中按钮后字体变色 代码 按钮变色 html <div class="ibox-content1"> <button type="button" class="btn btn-w-m1 btn-default margin10 " v-for="(item,index) in button_data" :key="index" :cla…

继续阅读 vue框架—–点击按钮变色、选中按钮后字体变色

[vuex] unknown mutation type: XXX/XXX 报错解决方法

  • Post author:
  • Post category:vue

unknown getter: XXX/XXX 报错解决方法 今天,用 vuex 中的 Module 来分割多个模块的时候,碰到了一个bug,今天,跟大家分享一下,先看一下报错内容吧 我的代码结构是这样的 index是主文件,liuxu和test是分割出来的,然后index.js里面引入这两个js 当我调用这两个模块中的mutations的时候,出现上面的报错,我的代码是这样写的 因为分模块了,所…

继续阅读 [vuex] unknown mutation type: XXX/XXX 报错解决方法

vue的render函数用法

  • Post author:
  • Post category:vue

1.render简介 前面我们的组件的模板都是在模板里写的(template),模板最后都会被vue编译成virtual dom(虚拟dom),在某些情况下模板可能不好用,例如需要实现一个动态的文章标题,根据父组件的level属性,动态的渲染成h1~hx标签,用模板写部分代码如下。 <article-header :level="1">Hello world</article-h…

继续阅读 vue的render函数用法