1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <template>
- <view class="content">
- <image class="logo" src="/static/logo.png"></image>
- <view class="text-area">
- <text class="title">{{title}}</text>
- </view>
- <button @click="cb"> 第1章复仇者
- </button>
- <view v-for="(v,k,i) in obj" key="k">
- <text> {{v}}{{i}}</text>
- </view>
- </view>
- </template>
- <script setup lang="ts">
- import { ref,reactive ,onMounted,onUnmounted,watch} from 'vue';
- let title = ref("123")
- let obj = reactive({a:"12",b:"123"});
- let cb = function(){
- alert("你有点呆呆的!")
- title.value = "fuck!"
- obj.a = "world";
- }
- onMounted(()=>{
-
- })
- onUnmounted(()=>{
- alert("我被卸载了")
- })
-
- watch(obj,async (new_v,old_v)=>{
- alert(`我被改变了${new_v}`)
- console.log(new_v,old_v)
- })
-
- </script>
- <style scoped>
- .content {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- }
- .logo {
- height: 200rpx;
- width: 200rpx;
- margin-top: 200rpx;
- margin-left: auto;
- margin-right: auto;
- margin-bottom: 50rpx;
- }
- .text-area {
- display: flex;
- justify-content: center;
- }
- .title {
- font-size: 36rpx;
- color: #8f8f94;
- }
- </style>
|