<!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta http-equiv="X-UA-Compatible" content="ie=edge" /> <title>对象属性定义方法</title> </head> <body> <ul> <li id="first">1</li> <li>2</li> <li>3</li> </ul> <script type="text/javascript"> var type = { THEME_UPDATE: ‘theme/update‘, VIS_THEME_UPDATE: ‘vis/theme/update‘ } var ss = { [type.THEME_UPDATE](state) { console.log(state) } } console.log(ss) //function console.log(typeof ss[type.THEME_UPDATE]) </script> </body> </html>
原文地址:https://www.cnblogs.com/mengfangui/p/9090223.html
时间: 2024-11-05 14:48:46