vue 学习笔记

获取到git代码后执行:npm install

1.在数组或者el-table中删除一行数据


<el-table>
<el-table-column label="编号" prop="empNo"></el-table-column>
<el-table-column label="姓名" prop="userName"></el-table-column>
<el-table-column label="操作" >
  <template  slot-scope="scope">
     <el-button type="text" size="small" @click.prevent="del(scope.$index,scope.row)">删除</el-button>
  </template>
</el-table-column>
</el-table>

//单击删除方法
del(index,row){
    this.userData.splice(index, 1)
 }

2.传后台数组方法 

--------------------------------------------------------------------------------
//数组集合转换为字符串,可以传到后台作为参数
JSON.stringify(this.checkUser)

//前台传值方法
this.$axios.post('接口地址',{userList:JSON.stringify(this.checkUser)})
//后台接收方法
String userList=input.get("userList").toString();
//转换数组
List<Map<String, Object>> list = TranUtils.jsonToBeanByTypeReference(userList,new TypeReference<List<Map<String, Object>>>() {});

----------------------------------------------------------------------------------
//字符串转换为json,可以把单个对象传到后台
JSON.parse(JSON.stringify(this.checkUser))

//传值方法
this.$axios.post('接口地址',JSON.parse(JSON.stringify(this.checkUser)))
----------------------------------------------------------------------------------

3.$ref父子页面传值

父页面:

<!--添加用户信息子页面-->

<template>

 <AddMessage

      :visble.sync="addDialog"

      v-if="addDialog"

      ref="AddMessage"

      @successCallback="sureAddHandle">

</AddMessage>

</template>

export default {
  components: {
    AddMessage,
  }
methods: {
     //添加用户弹窗
     addUserHandle() {
      //AddMessage标签中必须声明ref="AddMessage"
      this.$nextTick(() => {
        this.$refs.AddMessage.orgId=this.orgId;  //页面传值
        this.$refs.AddMessage.init();   //调用子页面方法
      })
    }
 }
}

props传值方法:

父页面:

在标签中直接调用
<targetMessage
      ref="targetMessage"
      :visible.sync="targetDialogShow"
      :eid="eid"
      :evaType="measurementForm.evaType"
      :showButton="showButton"
      @closedHandler="closedHandler"
></targetMessage>

引入页面
<script>
  import targetMessage from './targetManagement/targetConfigure.vue'
</script>

子页面:


export default {
  props: {
    visible: Boolean,
    eid: {
      type: Number,   //参数类型
      require: true,  //是否必填
    },
    evaType: {
      type: Number,
      require: true,
    },
    showButton:{
      type:Boolean,
      require:true
    }
  }
}

4.页面跳转传值

this.$router.push({path:'/management',query:{page:this.currentPage}})

页面接收参数:

data() {

    return {

               currentPage:this.$route.query.page==undefined?1:Number(this.$route.query.page)

      }

}

标颜色的地方有区别

5.子页面调用父页面方法

子页面:

createFunc(){

 this.$emit('successCallback', paperId)  //调用父页面方法

}

父页面:

<template>
    <addEvaPaperDialog

      ref="addEvaPaperDialog"

      :visible.sync="isShowAddEvaPaperDialog"

      @successCallback="addEvaPaperDialogSureAddHandle" >

   </addEvaPaperDialog>
</template>

script中代码

addEvaPaperDialogSureAddHandle(pId) {

      this.isShowAddEvaPaperDialog = false

      this.$router.push({

        name: 'evaquestion',

        query: { pId: pId, isView: 'false',page:this.page.currentPage }

      })

}

6.提示组件

   alter提示


this.$alert('请选择数据!','提示',{
   confirmButtonText: '确定',
   type: 'warning'
 })

效果:

confirm提示

this.$confirm('确定要删除吗?','提示',{
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning',  //类型有success,error,info和warning
      showCancelButton: true,  //是否显示取消按钮
      showClose: false, //是否显示右上角的x
      closeOnClickModal: false, //是否可以点击空白处关闭弹窗
    }).then(()=>{
      console.log('执行删除')
  }).catch(()=>{
      console.log('取消删除')
})

 效果:

7.获取el-table选中的值

<el-table :border="true"  :data="targetData" :header-cell-style="{ 'text-align': 'center' }"  max-height="350" @selection-change="handleSelectionChange">
   <el-table-column type="selection"></el-table-column>
    <el-table-column label="名字" prop="targetName"></el-table-column>
    <el-table-column label="组名字" prop="groupName"></el-table-column>
    <el-table-column label="标签名字" prop="labelName"></el-table-column>
 </el-table>

<script>
export default {
 data() {
    return {
       delArrayId:[],  //ID集合
     }
  }
  methods: {
    //表格选中事件
    handleSelectionChange(val){
      this.delArrayId=val;
    }
  }
}
</script>

8.el-dialog 自定义样式

<template>
 <el-dialog title="弹窗" :visible.sync="visible" :before-close="handleClose">
   <div class="tip-container">
      asdfasdfasdfasd
   </div>
   <div slot="footer">
      <el-button @click="()=>{this.visible=false}">取消</el-button>
      <el-button type="primary" @click="()=>{this.visible=false}">确定</el-button>
   </div>
 </el-dialog>
</template>

//scoped属性说明,组件的私有化,不对全局造成样式污染,表示当前style属性只属于当前模块。父组件是无法操作子组件的样式的
<style lang="scss" scoped>
::v-deep .el-dialog__body {
  border-top: 1px solid #dcdfe6;
  border-bottom: 1px solid #dcdfe6;
  padding: 15px 30px;
  overflow-y: auto;
  height: 450px;
  max-height: 85% !important;
  min-height: 70%;
}

::v-deep .el-dialog__title {
  font-size: 20px;
  font-weight: bold;
}

::v-deep .el-dialog__footer {
    padding: 10px 10px 10px;
    text-align: right;
}
</style>
//::v-deep说明:样式穿透,只能在scoped样式中使用。:deep() 适用于全局样式和嵌套组件中的样式

效果图:

### 安装和配置 Qv2ray #### 下载并准备 Qv2ray 应用程序图像文件 为了在 Ubuntu 上安装 Qv2ray,首先需要获取应用程序的 AppImage 文件。可以从官方网站或其他可信资源下载最新版本。 ```bash wget https://github.com/Qv2ray/Qv2ray/releases/download/v2.7.0/Qv2ray-v2.7.0-linux-x64.AppImage ``` #### 设置可执行权限 下载完成后,需设置该文件具有可执行权限以便启动它[^3]: ```bash sudo chmod +x ./Qv2ray-v2.7.0-linux-x64.AppImage ``` #### 创建桌面快捷方式(可选) 如果希望创建一个桌面图标来方便访问 Qv2ray,则可以按照下面的方法操作[^2]: 1. 编辑一个新的 `.desktop` 文件用于定义应用程序条目: ```bash cd /usr/share/applications && sudo gedit Qv2ray.desktop ``` 2. 将下列内容粘贴进去,并根据实际情况调整路径: ```ini [Desktop Entry] Encoding=UTF-8 Name=Qv2ray Comment=A GUI client for V2Ray based on Qt5. Exec=/path/to/your/Qv2ray-v2.7.0-linux-x64.AppImage Icon=/path/to/icon/Qv2ray.png Terminal=false StartupNotify=true Type=Application Categories=Network; ``` 3. 授予 `.desktop` 文件必要的权限使其成为有效的启动器: ```bash sudo chmod u+x Qv2ray.desktop ``` #### 解决可能遇到的问题 当更改用户组之后发现 Qv2ray 无法正常工作时,可能是由于缺少某些特定的能力(capabilities),可以通过给定二进制文件增加这些能力来修复这个问题[^4]: ```bash sudo setcap cap_net_bind_service=+ep cap_net_admin=+ep /path/to/qv2ray_executable_file ``` #### 配置全局代理(适用于命令行工具) 对于那些依赖于 HTTP 或 SOCKS5 协议的应用和服务来说,在设置了 Qv2ray 的监听端口后还需要进一步修改环境变量以实现全局代理功能[^5]。这通常涉及到编辑用户的 shell profile 文件如 `~/.bashrc` 添加如下几行代码: ```bash export http_proxy="http://127.0.0.1:8889" export https_proxy=$http_proxy export all_proxy="socks5://127.0.0.1:1089" ``` 完成上述步骤后记得使新的环境变量生效: ```bash source ~/.bashrc ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值