vue3自增

news/2024/7/10 2:27:03 标签: vue
<el-button @click="increase">自增</el-button>
import { reactive, toRefs, onMounted, getCurrentInstance, ref } from 'vue'
export default {
    setup() {
      const state = reactive({
          input: '',
          nub: '',
          time: '',
          cont: 1
      })
      const Counter = ref(0)
      const increase = () => {
	      //第一种方法
	      console.log(state.cont ++)
	      //第二种方法
	      console.log(Counter.value++)
      }
      return {...toRefs(state), onMounted, increase, Counter}
    }

http://www.niftyadmin.cn/n/1367723.html

相关文章

动态添加表格中下拉框

父级页面 <div class"threePart"><ul><li style"width:114px"><span style"color:red;">*</span>场景</li><li style"width:222px"><span style"color:red;">*</span&…

vue下载静态的模板

在组件文件中代码 export function downloadByA({ url, name temp }) {// 生成一个a元素const a document.createElement(a)// 创建一个单击事件const event new MouseEvent(click)// 设置图片名称a.download name// 如果跳转页面&#xff0c;则在其他页面跳转a.target _…

element UI中table组件不换行

.el-table .cell {white-space: nowrap;}

身份证保留前6位和后两位其它用*号代替

idNum.replace(/(\w{6})\w*(\w{2})/, $1**********$2)示例

elemet ui 时间区间不可超过1年

<el-form-item prop"dateArea" label"交易时间&#xff1a;"><el-date-pickertype"date"placeholder"选择开始日期"v-model"ruleForm.dateArea1"></el-date-picker><span style"margin: 0 5px;&q…

Vue全家桶构建项目

步骤一、安装vue-cli 首先&#xff0c;我们可以通过npm安装vue-clic,前提是我们需要有node环境&#xff0c;如果电脑还没安装node&#xff0c;先安装&#xff0c;可通过 node -v 查询node的版本号&#xff0c;有版本号则已经安装成功&#xff1b; vue全家桶项目构建教程 接下…

Vue下载文件不成功及下载文件名称问题

看代码 import axiosDown from "axios";downloadFile(path) {return axiosDown({url: path,method: "get",responseType: "blob" // 这一步也很关键&#xff0c;一定要加上 responseType 值为 blob});},downloadWay(item) {// console.log(item…

js代码优化

1.避免多条件并列 let status process; let arr [process, wait, fail] if (arr.includes(status)) {console.log(避免多条件并列--2);}