<template>
<div class="contains">
<!-- <div class="main">
<swiper :options='swiperOption' :not-next-tick=''></swiper>
</div> -->
<slide > <div v-for="(item,index) in banner" :data='sliderarr' :key="item+index">
<a>
<!-- <img class="clicks" :src='item.img_url' @load="loadImg" @click='goto_url()'> -->
<img class="clicks" :src='item.img_url' @click='goto_url()'>
</a>
</div>
</slide>
<p class="news"><b>幸运栏</b><span>恭喜{{users}}在{{games}}中获得<em>{{count}}</em>个金币</span></p>
</div>
</template> <script>
import {swiper,swiperSlide} from 'vue-awesome-swiper'
import slide from '../oslider'
export default{
components: {
slide
},
data () {
return {
sliderarr:[],
banner:[
{
img_url: "", },
{ }
], users:'“千尺干头”',
count:'8288',
games:'猜球游戏'
}
},
methods: {
goto_url(){ }
}
}
</script> <style lang="scss" scoped>
@import 'swiper/dist/css/swiper.css';
.contains{
p{
margin:0;
padding:0;
width:100%;
}
}
.news{
b{
// display: inline-block;
padding:0.02rem;
border-radius: 0.02rem;
background-color: #64ce66;
font-size: 0.12rem !important;
margin-left: 0.2rem;
margin-right: 0.2rem;
color:#fff;
}
span{
font-weight: bolder;
}
em{
color:#c11f2e;
font-style: normal;
}
background: #f6f6f6;
height: 0.5rem;
line-height: 0.5rem;
font-size: 0.14rem;
}
</style>

  

一般情况下的APP首页会单独拿出来做为一个组件,首页里面的内容就需要考虑 组件化开发;

再建立其他组件文件夹;

例如一个子组件需要渲染再index组件中;

子组件代码如上,这个里面只需要写组件内的代码不需要管其他;

然后再在根组件中导入。声明,使用;如下根组件代码

<template>
<div class="home">
<Heador/>
<Slider/>
<Plays/>
<Hotgame/>
<Footballguess/>
<Basketballguess/>
<Hotreward/>
</div>
</template> <script>
import Heador from "../components/index/heador.vue"
import Slider from "../components/index/Slider.vue"
import Plays from "../components/index/plays.vue"
import Hotgame from "../components/index/Hotgame"
import Footballguess from "../components/index/FootballGuess"
import Basketballguess from "../components/index/BasketballGuess"
import Hotreward from "../components/index/Hotreward" export default {
components: {
Heador,
Slider,
Plays,
Hotgame,
Footballguess,
Basketballguess,
Hotreward
},
name:"home"
}
</script> <style lang="scss"> </style>

  

使用vue-cli构建工具构建vue项目时候组件的使用的更多相关文章

  1. vue.js---利用vue cli脚手架工具+webpack创建项目遇到的坑

    1.Eslint js代码规范报错 WARNING Compiled with 2 warnings 10:43:26 ✘ http://eslint.org/docs/rules/quotes St ...

  2. 深入浅出的webpack构建工具--webpack4+vue搭建环境 (十三)

    深入浅出的webpack构建工具--webpack4+vue搭建环境 (十三) 从上面一系列的webpack配置的学习,我们现在来使用webpack来搭建vue的开发环境.首先我们来设想下我们的项目的 ...

  3. 深入浅出的webpack构建工具--webpack4+vue+router项目架构(十四)

    阅读目录 一:vue-router是什么? 二:vue-router的实现原理 三:vue-router使用及代码配置 四:理解vue设置路由导航的两种方法. 五:理解动态路由和命名视图 六:理解嵌套 ...

  4. 深入浅出的webpack4构建工具--webpack4+vue+route+vuex项目构建(十七)

    阅读目录 一:vue传值方式有哪些? 二:理解使用Vuex 三:webpack4+vue+route+vuex 项目架构 回到顶部 一:vue传值方式有哪些? 在vue项目开发过程中,经常会使用组件来 ...

  5. vue cli 3.0快速创建项目

    本地安装vue-cli 前置条件 更新npm到最新版本 命令行运行: npm install -g npmnpm就自动为我们更新到最新版本 淘宝npm镜像使用方法 npm config set reg ...

  6. 前端——Vue CLI 3.x搭建Vue项目

    一.Node安装 windows 1. Node.js (>=8.9, 推荐8.11.0+) Node官网下载 .msi 文件,按步骤下载安装即可. 安装完之后在cmd中输入 node -v,若 ...

  7. 基于vue cli 3.0创建前端项目并安装cube-ui

    前提条件: 安装node.js. 国内的开发者最好先配置淘宝镜像. 之后用cnpm来代替npm命令. 项目创建过程: 打开cmd,输入命令进入目标工作空间,以本机项目为例: cd /d d: cd D ...

  8. 使用vue/cli 创建一个简单的项目

    首先,电脑安装了node.js官方要求8.9 或更高版本 (推荐 8.11.0+) npm install -g @vue/cli # OR yarn global add @vue/cli 全局安装 ...

  9. ubuntu下安装vue/cli提示No command 'vue' found

    通过官方指令 npm install -g @vue/cli 安装vue脚手架提示: No command 'vue' found, did you mean: Command 'vpe' from ...

随机推荐

  1. const 对象的属性能否修改

    const保证的并不是变量的值不能改动,而是变量指向的那个内存地址不能改动. 对于基本类型的数据(数值.字符串.布尔值),其值就保存在变量指向的那个内存地址,因此等同于常量. 对于引用类型的数据(主要 ...

  2. 《前端运维》一、Linux基础--06Shell流程控制

    这章我们来学习下流程控制,简单来说就是逻辑判断和循环的写法.并不复杂,我们来简单地看下. 1.if语句 shell的if语句有两种写法,一种是shell脚本式的,一种是命令式的. if conditi ...

  3. 分布式session的几种解决方案

    现在很多商城,都会要求用户先去登录,登录之后再往购物车中添加商品,这样用户.购物车.商品,三个对象之间就有了绑定关系. 而针对我最开始说的那种情况,其实就是基于session做的,客户端往购物车中添加 ...

  4. python 模块之 selenium 自动化使用教程

    一.安装 pip install Selenium 二.初始化浏览器 Chrome 是初始化谷歌浏览器 Firefox 是初始化火狐浏览器 Edge 是初始化IE浏览器 PhantomJS 是一个无界 ...

  5. java高级用法之:无所不能的java,本地方法调用实况

    目录 简介 JDK的本地方法 自定义native方法 总结 简介 相信每个程序员都有一个成为C++大师的梦想,毕竟C++程序员处于程序员鄙视链的顶端,他可以俯视任何其他语言的程序员. 但事实情况是,无 ...

  6. vs 2019 社区版 .net core 5.0 之 .net core ef 迁移问题方案

    问题一:Add-Migration 时出现 此类问题一般都是模型类主键标识问题增加KEY即可解决 报错: The entity type 'xxxx' requires a primary key t ...

  7. Android studio Error occurred during initialization of VM

    Unable to start the daemon process. This problem might be caused by incorrect configuration of the d ...

  8. react单向数据流怎么理解?

    React是单向数据流,数据主要从父节点传递到子节点(通过props).如果顶层(父级)的某个props改变了,React会重渲染所有的子节点.

  9. 面试问题之C++语言:简述编译过程

    转载于:https://blog.csdn.net/ypshowm/article/details/89374706 编译过程主要分为四步: 1.词法分析(扫描) 运行类似于有限状态机的算法将源代码的 ...

  10. String s = new String("xyz");创建了几个字符串对象?

    两个对象,一个是静态区的"xyz",一个是用new创建在堆上的对象.