Browse Source

add test code

feat
wally 4 years ago
parent
commit
6414def600
  1. 12
      components/Common/Hello.vue
  2. 9
      components/Hello.vue
  3. 7
      pages/index.vue
  4. 3
      plugins/vant.js

12
components/Common/Hello.vue

@ -1,3 +1,13 @@
<template>
<h1>Common Hello.vue</h1>
<h1>
Common Hello.vue <br /><small>{{ modalDisplay }}</small>
<van-button type="primary" @click="modalDisplay = !modalDisplay">
主要按钮
</van-button>
</h1>
</template>
<script setup>
const modalDisplay = useModal();
console.log(modalDisplay.value);
</script>

9
components/Hello.vue

@ -1,3 +1,10 @@
<template>
<div>Hello</div>
<div>
Hello
<h2>{{ modalDisplay }}</h2>
</div>
</template>
<script setup>
const modalDisplay = useModal();
</script>

7
pages/index.vue

@ -2,6 +2,9 @@
<div>
<Hello />
<CommonHello />
{{ testString }}
<van-image
class="user-poster"
src="https://img.yzcdn.cn/public_files/2017/10/23/8690bb321356070e0b8c4404d087f8fd.png"
@ -43,6 +46,10 @@ export default {
};
</script>
<script setup>
const testString = ref('Hello world');
</script>
<style lang="less">
body {
margin: 0;

3
plugins/vant.js

@ -1,7 +1,7 @@
// 目前在 nuxt 中无法按需引入样式,因此采用手动引入的方式
import 'vant/lib/index.css';
import { Cell, CellGroup, Col, Icon, Image, Row } from 'vant';
import { Button, Cell, CellGroup, Col, Icon, Image, Row } from 'vant';
import { defineNuxtPlugin } from '#app';
@ -12,5 +12,6 @@ export default defineNuxtPlugin(nuxtApp => {
.use(Image)
.use(Icon)
.use(Cell)
.use(Button)
.use(CellGroup);
});

Loading…
Cancel
Save