e 3 сар өмнө
parent
commit
1f7c7a6da9

+ 6 - 6
13.Vue3/project2/src/components/Demo7.vue

@@ -25,16 +25,16 @@ let fullName = computed({
     },
     },
     set(val) {
     set(val) {
         console.log(val,'val')
         console.log(val,'val')
-
+        let [a1,a2] = val.split('-');
+        firstName.value = a1;
+        lastName.value = a2;
     }
     }
 })
 })
 function changeName() {
 function changeName() {
     console.log("点击了")
     console.log("点击了")
-    fullName.set('胡-图图')
-}
-function getName() {
-    console.log("哈哈哈")
-    return firstName.value + lastName.value; 
+    console.log("哈哈哈",fullName.value)
+    // return firstName.value + lastName.value; 
+     fullName.value = '糖-果'
 }
 }
 </script>
 </script>
 <style lang='scss' scoped>
 <style lang='scss' scoped>