首页 > 代码库 > yii2_vue_表单案例

yii2_vue_表单案例

<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/2/5
 * Time: 17:36
 */
use yii\helpers\Url;
use \common\models\AdminSite;
use \common\utils\Cache;
use \common\services\TudouService;

$adminsite=Cache::GAutoRoute(‘adminsite‘,TudouService::class,‘getAdminSite‘,60);
$keywords=Cache::GAutoRoute(‘keywords‘,TudouService::class,‘getKeywords‘,0,60);
$channel=Cache::GAutoRoute(‘channel‘,TudouService::class,‘getChannel‘,0,60);
//$channel代表AR

?> <div class="container"> <form id="demo" method="post" class="form " action="<?=Url::toRoute(‘admin-npsearch/test‘)?>"> <div class="row"> <div class="col-md-4"> <label class="span6">分类ID-:</label> <select class="form-group span6" name="FTypeID" v-model="FTypeID"> <option v-for="(item,key) in admin_channel.options" :value="http://www.mamicode.com/item.fid">{{item.name}}</option> </select> {{FTypeID}} </div> </div> <input class="btn btn-success btn-block" type="submit"> </form> </div> <script> new Vue({ el: ‘#demo‘, data: { keyword: ‘‘, FTypeID: ‘1‘, FSiteID: ‘1‘, FKeywordID:‘1‘, site: { options:<?=$adminsite?> }, keywords: { options:<?=$keywords?> }, admin_channel: { options:<?=$channel?> }, } }); </script>

 

yii2_vue_表单案例