We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1、创建一个新对象,如:var person = {}; 2、新对象的_proto_属性指向构造函数的原型对象。 3、将构造函数的作用域赋值给新对象。(也所以this对象指向新对象) 4、执行构造函数内部的代码,将属性添加给person中的this对象。 5、返回新对象person。 var person = {}; person._proto_ = Person.prototype; //引用构造函数的原型对象 Person.call(person); //将构造函数的作用域给person,即:this值指向person
app.use(cors({ origin: function(ctx) { const whiteList = [, 'http://127.0.0.1:6001', '']; console.log(ctx.origin); if(ctx.origin in whiteList) { return ctx.origin; } return "http://0.0.0.0:9000"; }, credentials: true, "Access-Control-Allow-Credentials":"true", }))
function parseString(str, obj) { Object.keys(obj).forEach(key => { // str = str.replace(new RegExp(`{{${key}}}`,'g'), obj[key]); // str = str.replace(/`\$\{${key}\}`/g, obj[key]) str = str.replace(new RegExp(`\{${key}\}`,'g'), obj[key]); }); return str; } // const str = "{{name}}很厉name害{{name}},才{{age}}岁"; const str = "{name}很厉name害{name},才{age}岁"; const obj = { name: "qy", age: "18" }; console.log(parseString(str, obj)); function runTemplate(stringTemplate, row = {}) { return eval("`" + stringTemplate + "`"); } console.log(runTemplate("年龄:${row.age}", { age: 20 })); // "年龄:20" // 去除括号 // "${}${}${}".replace(/\$({)/g,function($, $1){return $1;})
The text was updated successfully, but these errors were encountered:
No branches or pull requests
常见问题
css
布局
react
node
算法
The text was updated successfully, but these errors were encountered: