计算属性的 Setter,是什么?没懂

news/2024/7/10 1:47:52 标签: vue

这段是哪里来的

computed: {
  fullName: {
    // getter
    get() {
      return this.firstName + ' ' + this.lastName
    },
    // setter
    set(newValue) {
      const names = newValue.split(' ')
      this.firstName = names[0]
      this.lastName = names[names.length - 1]
    }
  }
}

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

相关文章

localhost拒绝了我们的连接请求

问题展现 解决方法 其中一个错因是接口错了,可以看看接口是否正确。 查看控制台日志

Cannot resolve symbol ‘java‘

问题描述 我这个问题是在一个非maven项目里面,加入了maven项目,然后把maven项目变成了一个模块module。然后就出现问题了,Cannot resolve symbol ‘java’。 查看博客,(参考:https://blog.csdn.net/yjt13/…

np.nditer、flags=[‘multi_index‘] 用法

参考:https://www.jianshu.com/p/f2bd63766204 it np.nditer(altitude_matrix, flags[multi_index], op_flags[readwrite])min altitude_matrix.min()while not it.finished:length it.multi_index[0]width it.multi_index[1]altitude_matrix[length, width] - …

kafka安装包下载慢,国内镜像下载地址

kafka国内镜像下载地址 阿里云开源镜像站:http://mirrors.aliyun.com/apache/kafka/

'chcp' 不是内部或外部命令,也不是可运行的程序 或批处理文件。 'cmd' 不是内部或外部命令,也不是可运行的...

打开anaconda promp 提示chcp 不是内部或外部命令,也不是可运行的程序 或批处理文件。 cmd 不是内部或外部命令,也不是可运行的 解决办法: 我在安装Anaconda是默认添加了环境变量,此时需要在环境变量的系统变量的path后面添加;C:\Windows\System32 之后…

【pip】raise MaxRetryError(_pool, url, error or ResponseError(cause))

报错 raise MaxRetryError(_pool, url, error or ResponseError(cause)) pip._vendor.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host‘files.pythonhosted.org’, port443): Max retries exceeded with url: /packages/f2/94/3af39d34be01a24a6e65433d19e10709…

Pycharm中安装numpy和pands出现ImportError:DLL load failed:找不到指定模块的解决方法

本来用的好好的,结果在虚拟环境里想用pandas保存numpy数据到本地,然后安装pandas,然后就报错 ImportError:DLL load failed:找不到指定模块的解决方法 神奇的是,用命令行引用numpy就没有问题,而在pycharm就会报错&am…

不是很懂,用心体会一下,反正行文就是十分的怪异。代码看起来像这样,这是什么话。为什么通过webpack就要写成这样

如果你通过 Babel 和 webpack 使用 ES2015 模块,那么代码看起来像这样: import ComponentA from ‘./ComponentA.vue’ export default { components: { ComponentA } // … } 注意在 ES2015 中,在对象中放一个类似 ComponentA 的变量名其实…