Thinkphp5.1+Vue自动化构建解决方案

浏览:12011 发布日期:2018/07/27 分类:系统代码
丢弃老旧的jquery开发方式吧.使用webpack构建工具开始你的新世界
ThinkPHP 5.1 + Vue 自动化构建解决方案
依赖nodejs yarn

一个index.vue文件示例的登录demo<style scoped lang="scss">
  .main {
    margin: 0 auto;
    max-width: 500px;
    background: #fff;
    border: solid 1px #ddd;
    padding: 15px;
  }
  input {
    outline: none;
    width: 100%;
    border: solid 1px #4288ce;
    padding: 10px;
    color: #888;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
  }
  .login-btn {
    background: #000088;
    border: solid 1px #000088;
    padding: 6px 15px;
    width: 140px;
    color: #fff;
    text-align: center;
  }
</style>

<template>
  <section>
    <div class="main">
      <h1>登录demo</h1>
      <p>
        <input v-model="form.username" placeholder="请输入登录帐号">
      </p>
      <p>
        <input v-model="form.password" placeholder="请输入登录密码">
      </p>

      <p style="text-align: right">
        <button class="login-btn" @click="onLogin">登录</button>
      </p>
    </div>
  </section>
</template>

<script>
  import Component from 'vue-class-component'

  @Component
  export default class Index extends Vue {
    form = {}

    onLogin () {
        alert('登录成功')
    }
  }
</script>
vue-loader让我们可以使用css预处理工具.也让我们css模块化(在style写的样式都只在此文件有效,前提是你没删掉scoped)

github.com : https://gitee.com/kingeasts/tp5_vue_authbuild/tree/master
评论( 相关
后面还有条评论,点击查看>>