Vue.js

vue数组中对象属性变化页面不渲染问题

谁都会走 提交于 2020-12-27 03:48:03
问题引入 Vue之所以能够监听Model状态的变化,是因为 JavaScript语言本身提供了Proxy或者Object.observe()机制来监听对象状态的变化 。但是,对于数组元素的赋值,却没有办法直接监听。 因此,如果我们直接对数组元素赋值 <ul> <li v- for ="(item,index) in arrInfo">{{item.name}}--{{item.age}}</li> </ul> data(){ return { arrInfo:[ { 'name':'zuobaiquan','age':22 }, { 'name':'zhangsan','age':20 } ] } }, // created(){ // this.arrInfo[0]={'name':'zuobaiquan01','age':22} // }, mounted(){ this .arrInfo[0]={'name':'zuobaiquan02','age':22 } } 在mounted阶段,直接对数组元素 arrInfo 赋值会导致Vue无法更新View 说明:在 created 视图未渲染时 直接对数组元素 arrInfo 赋值 data里面的初值会改变的。 此时在mounted阶段,简单的做法是 不要对数组元素赋值,而是更新 mounted(){ this .arrInfo

XiaoNuo快速开发平台代码生成发布啦

元气小坏坏 提交于 2020-12-27 00:54:32
小诺团队做开源已经将近一个月,在平时忙碌的工作之余跟晚上的时间,也在抓紧时间做开发。 在此时间段当然我们的其他产品也不能停下来,就好比:xiaonuo-layui版本的工作流大模块、xiaonuo-cloud版本,相信很快跟小伙伴们见面。 为了加快cloud版本日程,小诺团队成员也由2人增加到3人!同时也欢迎其他有想法的小伙伴加入到我们的开源中一起做贡献,可以在官网获取联系方式与我们沟通! 此次一共发布了xiaonuo-vue版本与xiaonuo-layui版本的代码生成器,完全独立的模块,可拓展,可二次开发,为普通模块开发省去了大部分拷贝粘贴的时间。 可生成所有查询框、查询条件根据不同的需求进行删减,下个版本会在此基础上面增加详细到每个字段在各个代码模块下的配置 感兴趣的小伙伴可以关注下我们,全系版本都免费,我们的官网是: https://xiaonuo.vi p 来源: oschina 链接: https://my.oschina.net/u/3359742/blog/4842451

vue2.0实现倒计时15分钟

那年仲夏 提交于 2020-12-27 00:28:49
<template> <div> <p>{{minute}}:{{second}}</p> </div> </template> <script type="text/ecmascript-6"> export default { data () { return { goodsObj: [ { name: '大胖的店' , checked: false , list: [ { name: '麻辣二胖' , price: 23.00 , realStock: 10 , fare: 1.5 , num: 1 , checked: false }, { name: '香辣二胖' , price: 21.00 , realStock: 2 , fare: 1.5 , num: 2 , checked: false }, { name: '红烧二胖' , price: 88.00 , realStock: 8 , fare: 1.5 , num: 4 , checked: false } ] } ], minutes: 15 , seconds: 0 } }, mounted () { this .add() }, methods: { num: function (n) { return n < 10 ? '0' + n : '' + n }, add: function () {

落户上海!分享心得,再做个积分计算器

余生长醉 提交于 2020-12-26 20:32:56
等了很久,终于收到落户批复啦!就差后面办一些手续。 这篇文章首先分享一下自己作为一名本科生,通过攒积分成功落户上海的一些心得。然后手把手带大家使用 Vue 框架开发一个『 上海应届生落户积分计算器 』网站。 建议先观看短视频简单了解下,然后选择自己感兴趣的部分阅读。 落户心得 以前从没想过要留在上海,但后来在上海读书,待了一年后,有些习惯了,也逐渐开始爱上这座城市。 我是从大二开始确定落户目标的,一开始什么都不懂,也根本没想过要落户。虽然家长亲戚一直在我耳边叮嘱落户多么多么重要,但当时我的心态就是 “反正买不起房,落不落户不都一样?” 后来,自己上网查询了有关户口的信息,突然发现校园落户比社会落户要容易许多,现在清北复交等多所名校的学生甚至可以直接落户! 如果能在毕业时直接落户,将为以后省去不少的麻烦,即使买不起车房,但是先有一个户口总比没有好。 当时上海市落户积分 72 分才能达标,于是我就按照积分规则来简单计算了一下: 积分项 情况 得分 最高学历 本科 21 毕业学校 第一类高校 15 最高学历毕业在沪 是 2 学习成绩 一级 8 外语水平 英语六级 8 计算机水平 计算机专业 7 用人单位分 满足条件 5 除了学历外,上述积分项我都拿到了最高分,但总计也只有 66 分,也就是说,如果没有任何竞赛、荣誉、专利等加分,距离落户还差整整 6 分! 怎么去凑这 6 分呢?在当时来看

VUE登陆界面监听回车键响应登陆按钮

五迷三道 提交于 2020-12-26 15:50:42
参考: vue 实现登录键盘enter事件 这篇的方法 我的html按钮: <el-button type="primary" v-on:keyup.13.native="submit" id="denglu" class="denglu" @click="login('ruleForm2')">登录</el-button> css样式: /* 登陆按钮input方法,就用不到这个表单 */ .denglu{ background-image: url(../../../assets/images/img/00_log_in/login_button_login_normal.png);//重点 width: 3.38rem; height: 0.53rem; margin-top: 0.2rem; background-repeat: no-repeat;//重点 border-radius: 10px; /*圆角 *///重点 } 方法一: 接下来就是按照他的方法: created() { // this.setLogin(); //按回车键响应 var _this = this; document.onkeydown = function(e) { let key = window.event.keyCode; if (key == 13) { _this.login();

why i am getting error of “cannot read property 'state' of undefined ” in vue js

此生再无相见时 提交于 2020-12-26 15:33:35
问题 my store/index.js is : import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) export default new Vuex.Store({ state: { name: 'Alicia Vikander', age: 20, dob: '20/08/1990' }, mutations: { updateName(state, name) => { state.name = name } } }) and my component.vue is : <template> <div> {{ $store.state.name }} </div> </template> why i am getting error of cannot read property 'state' of undefined in vue js ? please help.. thanks in advance 回答1: Are you sure you have injected store to the

why i am getting error of “cannot read property 'state' of undefined ” in vue js

我的梦境 提交于 2020-12-26 15:30:39
问题 my store/index.js is : import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) export default new Vuex.Store({ state: { name: 'Alicia Vikander', age: 20, dob: '20/08/1990' }, mutations: { updateName(state, name) => { state.name = name } } }) and my component.vue is : <template> <div> {{ $store.state.name }} </div> </template> why i am getting error of cannot read property 'state' of undefined in vue js ? please help.. thanks in advance 回答1: Are you sure you have injected store to the

why i am getting error of “cannot read property 'state' of undefined ” in vue js

China☆狼群 提交于 2020-12-26 15:18:16
问题 my store/index.js is : import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) export default new Vuex.Store({ state: { name: 'Alicia Vikander', age: 20, dob: '20/08/1990' }, mutations: { updateName(state, name) => { state.name = name } } }) and my component.vue is : <template> <div> {{ $store.state.name }} </div> </template> why i am getting error of cannot read property 'state' of undefined in vue js ? please help.. thanks in advance 回答1: Are you sure you have injected store to the

Your password may be compromised Chrome popup

房东的猫 提交于 2020-12-26 11:21:41
问题 I just launched my website on firebase hosting. Design and login forms were created with webflow. Website built with nuxt js. For some reason, every time i try to login with login form, i get a popup from Chrome: Your password may be compromised - You just entered your password on a deceptive site.... What exactly is coursing this error ? I have tried changing my password, i have tried simplifying the form by removing tags like name , id, data-name which is normally added to it via webflow. I

Your password may be compromised Chrome popup

删除回忆录丶 提交于 2020-12-26 11:18:25
问题 I just launched my website on firebase hosting. Design and login forms were created with webflow. Website built with nuxt js. For some reason, every time i try to login with login form, i get a popup from Chrome: Your password may be compromised - You just entered your password on a deceptive site.... What exactly is coursing this error ? I have tried changing my password, i have tried simplifying the form by removing tags like name , id, data-name which is normally added to it via webflow. I