1.首先在根目录中pages创建目录common,再创建您要引入的Vue页面,比如csdn.vue
2.在csdn.vue页面里您编写自己要开发的内容 根据自己的需求进行修改,我只是举例
[JavaScript] 纯文本查看 复制代码 <template>
<view class="content" >
<view class="biaoti">
CSND
</view>
</view>
</template>
<script>
export default {
data() {
return {
pmkuandu: '',
pmgaodu: '',
}
},
onLoad() {
},
methods: {
},
}
</script>
<style>
.content{
background-color: darkcyan;
}
.biaoti{
color: #ff0000;
}
</style>
3.然后在index.vue页面进行引入
[JavaScript] 纯文本查看 复制代码 <template>
<view class="content">
</view>
<view class="csdn">
<csdn :style="{ height: pmgaodu + 'px', width: pmkuandu + 'px' }"></csdn>
</view>
</template>
<script>
import csdn from '/pages/common/csdn.vue'
export default {
components:{
csdn
},
data() {
return {
}
},
onLoad() {
},
methods: {
}
}
</script>
<style>
.content {
z-index: 5;
position: relative;
}
.csdn {
display: flex;
z-index: 3;
position: fixed;
top: 0px;
margin-left: 0px;
}
</style> |