|
@ -2,35 +2,40 @@ |
|
|
<h1>{{ msg }}</h1> |
|
|
<h1>{{ msg }}</h1> |
|
|
<button |
|
|
<button |
|
|
class="border border-purple-200 rounded-full font-semibold py-1 px-4 text-sm text-purple-600 hover:bg-purple-600 hover:border-transparent hover:text-white focus:outline-none focus:ring-2 focus:ring-purple-600 focus:ring-offset-2" |
|
|
class="border border-purple-200 rounded-full font-semibold py-1 px-4 text-sm text-purple-600 hover:bg-purple-600 hover:border-transparent hover:text-white focus:outline-none focus:ring-2 focus:ring-purple-600 focus:ring-offset-2" |
|
|
@click="count++" |
|
|
|
|
|
|
|
|
@click="inc1" |
|
|
> |
|
|
> |
|
|
inc product {{ count }} |
|
|
|
|
|
|
|
|
inc product {{ count1 }} |
|
|
</button> |
|
|
</button> |
|
|
<button |
|
|
<button |
|
|
class="border border-purple-200 rounded-full font-semibold py-1 px-4 text-sm text-purple-600 hover:bg-purple-600 hover:border-transparent hover:text-white focus:outline-none focus:ring-2 focus:ring-purple-600 focus:ring-offset-2" |
|
|
class="border border-purple-200 rounded-full font-semibold py-1 px-4 text-sm text-purple-600 hover:bg-purple-600 hover:border-transparent hover:text-white focus:outline-none focus:ring-2 focus:ring-purple-600 focus:ring-offset-2" |
|
|
@click="inc" |
|
|
|
|
|
|
|
|
@click="inc2" |
|
|
> |
|
|
> |
|
|
inc |
|
|
|
|
|
|
|
|
inc {{ count2 }} |
|
|
</button> |
|
|
</button> |
|
|
|
|
|
state = {{ state.count }} |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script lang="ts"> |
|
|
<script lang="ts"> |
|
|
|
|
|
import global from '@/stores/global' |
|
|
import { defineComponent, ref } from 'vue' |
|
|
import { defineComponent, ref } from 'vue' |
|
|
export default defineComponent({ |
|
|
export default defineComponent({ |
|
|
props: { |
|
|
props: { |
|
|
msg: { type: String, required: true } |
|
|
msg: { type: String, required: true } |
|
|
}, |
|
|
}, |
|
|
setup() { |
|
|
setup() { |
|
|
return { |
|
|
|
|
|
count: ref(0) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
const count1 = ref(0) |
|
|
|
|
|
const count2 = ref(0) |
|
|
|
|
|
const { state } = global |
|
|
|
|
|
return { count1, count2, state } |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
inc() { |
|
|
|
|
|
// console.log('log count') |
|
|
|
|
|
console.warn('warn count') |
|
|
|
|
|
console.error('err count') |
|
|
|
|
|
this.count++ |
|
|
|
|
|
|
|
|
inc1() { |
|
|
|
|
|
console.warn(`inc1 ${this.count1}`) |
|
|
|
|
|
this.count1++ |
|
|
|
|
|
}, |
|
|
|
|
|
inc2() { |
|
|
|
|
|
console.error(`inc2 ${this.count2}`) |
|
|
|
|
|
this.count2++ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|