Browse Source

master

master
邓宏 3 years ago
parent
commit
5c210235a1
  1. 10
      src/components/HelloWorld.vue
  2. 1
      src/router/index.js
  3. 6
      src/views/Home.vue

10
src/components/HelloWorld.vue

@ -35,11 +35,6 @@ a {
<!-- v-memo 类似于 v-one 数组内的值变换时会更新 -->
<p v-memo="[b]">
{{count}}
<a href="https://vitejs.dev/guide/features.html" target="_blank">
Vite Documentation
</a>
|
<a href="https://v3.vuejs.org/" target="_blank">Vue 3 Documentation</a>
</p>
<div class="demo">1-<span>2</span></div>
<button type="button" @click="count++">count is: {{ count }}</button>
@ -47,6 +42,8 @@ a {
<span>Edit</span>{{foo}}
<code>components/HelloWorld.vue</code> to test hot module replacement.
</p>
--{{num}}
<hello-world v-if="num>0" :num="num-1" msg="-----msg----"/>
</template>
<script setup>
import { ref, useAttrs, useSlots, useCssVars, inject, defineExpose } from 'vue'
@ -55,7 +52,8 @@ a {
console.log(useAttrs(),'-------useAttrs-------')
console.log(useSlots(),'---------useSlots--')
defineProps({
msg: String
msg: String,
num: Number
})
useCssVars(e=>{
console.log(e,"-----------ctx----")

1
src/router/index.js

@ -15,7 +15,6 @@ const routes = [
component: b,
},
];
window.r=routes
const router = createRouter({
history: createWebHashHistory(),
routes,

6
src/views/Home.vue

@ -4,7 +4,7 @@
<template>
<div @click="$router.push({path:'/demo'})">demo</div>
<img alt="Vue logo" src="~@/assets/img/logo.png" />
<hello-world v-if="false" msg="Hello Vue 3 + Vite" ref="hello" style="color:red;" class="hello">
<hello-world msg="Hello Vue 3 + Vite" :num='1' style="color:red;" class="hello">
<div class="a">111</div>
<template #demo>
<div>2222222</div>
@ -14,8 +14,6 @@
<script setup>
// import HelloWorld from '@/components/HelloWorld.vue'
import { defineAsyncComponent, onMounted, ref } from 'vue'
var HelloWorld = defineAsyncComponent(()=>import('@/components/HelloWorld.vue'))
import HelloWorld from "@/components/HelloWorld.vue"
console.log("-------------home-------setup-----")
var hello=ref(null)
</script>
Loading…
Cancel
Save