sub.vue
<template>
<div>
<div>hello world</div>
<div>
{{time}}
</div>
<uni-card>
<text>这是一个基础卡片示例,内容较少,此示例展示了一个没有任何属性不带阴影的卡片。123123</text>
</uni-card>
<button @click="open">打开弹窗</button>
<uni-popup ref="popup" type="bottom">底部弹出 Popup</uni-popup>
</div>
</template>
<script>
export default {
data() {
return {
time: new Date().getTime(),
}
},
onLoad() {
console.log('sub')
},
methods: {
open() {
// 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ,type 属性将失效 ,仅支持 ['top','left','bottom','right','center']
this.$refs.popup.open('top')
}
}
}
</script>
<style>
</style>
pages.json
{
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "hello uniapp"
}
},
{
"path": "pages/sub/sub",
"style": {
"navigationBarTitleText": "sub"
}
}
],
"globalStyle": {
// #ifdef H5
"navigationStyle":"custom",
// #endif
"navigationBarTextStyle": "black",
"navigationBarTitleText": "hello uniapp",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
},
"easycom": {
"autoscan": true,
"custom": {
"^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue"
}
}
}
j***@163.com (作者)
感谢回复,有用!这个配置挺重要的,建议在文档里面增加说明。
2022-02-18 14:19