• vue的坑


    1.获取地址栏参数  this.$route.query.id

    2.用this.$router.push({path:'index',query:{id:1}})跳转页面无刷新,无法监听传递的参数,可用以下方法解决:

    watch:{

      '$route':'fun'

    }

    fun为地址栏变化要写的函数

    3.组件变量是数组的,v-for时,要写:key="index";

    4.在光标处插入值

    <textarea ref="mytextarea" v-model='editMsg' class="editMsg" maxlength="333" ></textarea>
    cursorInput(str){  //光标位置插入值
    var tc = this.$refs.mytextarea;
    var tclen = this.editMsg.length;
    tc.focus();
    if(typeof document.selection != "undefined"){
    document.selection.createRange().text = str;
    }else{
    this.editMsg= this.editMsg.substr(0,tc.selectionStart)+str+this.editMsg.substring(tc.selectionStart,tclen);
    }
    },
  • 相关阅读:
    相机的使用
    win11系统必知知识
    学历真的没有用吗?
    你的牙齿还好吗?
    管理
    excel导入工具类
    excel导出工具类
    StringUtil工具类
    Python 面向对象
    Python 反射
  • 原文地址:https://www.cnblogs.com/miaSlady/p/8277094.html
Copyright © 2020-2023  润新知