我是 Vue 新手,这也是我在 Vue 上的第一个项目。我有三个包含空值的输入字段。select如果输入字段 1 收到超过 5 个字符,是否有办法自动转到第二个输入字段或使其移动?并转到输入字段 3,或者如果输入字段 2 包含超过 5 个字符,则选择输入字段 3?
看法
<div id="app">
<h2>Input Fields:</h2>
<div v-for="(todo,index) in todos" :key="index">
<b-form-input type="text" v-model="todo.datatype" :value="todo.id" placeholder="Insert Datatype"
v-on:input="moveToNextField($event)"></b-form-input>
/** If the input field 1, consists more than 5 characters. Automatically move on to second input field **/
<br>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
脚本
new Vue({
el: "#app",
data: {
todos: [
{ id: "1", datatype: ""},
{ id: "2", datatype: ""},
{ id: "3", datatype: ""} …Run Code Online (Sandbox Code Playgroud) 嘿,我对 Vue 真的很陌生,对于这个项目,我有一个下载按钮,用户可以从中下载文件。当我单击“下载”按钮时,它会继续在同一浏览器中打开文件而不是下载它。a-href他们是制作或button function下载文件的方法吗?
我在 jsFiddle https://jsfiddle.net/ez36jmx5/10/上的代码。
看法
<div id="app">
<a href="https://homepages.cae.wisc.edu/~ece533/images/airplane.png" download>DOWNLOAD</a>
<br><br>
<button v-on:click="clickedDownload()"> <!-- opens files in new tab -->
DOWNLOAD
</button>
</div>
Run Code Online (Sandbox Code Playgroud)
方法
new Vue({
el: "#app",
data: {
},
methods: {
clickedDownload(){
var fileName='https://homepages.cae.wisc.edu/~ece533/images/airplane.png';
window.open(fileName, 'Download');
}
}
})
Run Code Online (Sandbox Code Playgroud) 我对 vue 非常陌生,对于这个项目,我使用 Vue、Bootstrap-vue 来对我的数据 teamList 进行分页。有没有一种方法可以将 更改teamList.first_name为链接,以便onSelect or onClick在用户单击first_name 值后我可以使用事件。
JsFiddle 上的代码= https://jsfiddle.net/ujjumaki/aLdgo7xq/8/
看法
<div class="overflow-auto">
<b-pagination v-model="currentPage" :total-rows="rows" :per-page="perPage" aria-controls="my-table"></b-pagination>
<p class="mt-3">Current Page: {{ currentPage }}</p>
<b-table id="my-table" :items="teamList" :per-page="perPage" :current-page="currentPage" medium selectable>
</b-table>
</div>
Run Code Online (Sandbox Code Playgroud)
JavaScript
data(){
return{
teamList: [
{ id: 5, first_name: 'Pebbles', last_name: 'Flintstone' },
{ id: 6, first_name: 'Bamm Bamm', last_name: 'Rubble' },
{ id: 7, first_name: 'The Great', last_name: 'Gazzoo' },
{ id: 8, first_name: 'Rockhead', last_name: 'Slate' …Run Code Online (Sandbox Code Playgroud)