|
@@ -0,0 +1,25 @@
|
|
|
+/*
|
|
|
+ * @Description: js类测试
|
|
|
+ * @Autor: kindring
|
|
|
+ * @Date: 2021-09-06 16:18:22
|
|
|
+ * @LastEditors: kindring
|
|
|
+ * @LastEditTime: 2021-09-06 16:22:29
|
|
|
+ * @LastDescript:
|
|
|
+ */
|
|
|
+class Fn {
|
|
|
+ constructor(id, name) {
|
|
|
+ this.id = id
|
|
|
+ this.name = name
|
|
|
+ }
|
|
|
+ say(talk) {
|
|
|
+ console.log(`${this.name}:${talk}`);
|
|
|
+ this.onSay({ date: new Date(), talk })
|
|
|
+ }
|
|
|
+ static onSay() {}
|
|
|
+}
|
|
|
+
|
|
|
+let f = new Fn(1, '张三')
|
|
|
+f.onSay = function(e) {
|
|
|
+ console.log(e)
|
|
|
+}
|
|
|
+f.say('你好')
|