Skip to content

Instantly share code, notes, and snippets.

@kenny-io
Created April 23, 2019 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenny-io/6d1a65e6673304d50397edd18cb2e860 to your computer and use it in GitHub Desktop.
Save kenny-io/6d1a65e6673304d50397edd18cb2e860 to your computer and use it in GitHub Desktop.
//src/components/Navbar.vue
<template>
<div>
<b-navbar toggleable="lg" type="dark" variant="success">
<b-container>
<b-navbar-brand href="#">Mealzers</b-navbar-brand>
<b-navbar-toggle target="nav-collapse"></b-navbar-toggle>
<b-collapse id="nav-collapse" is-nav>
<!-- Right aligned nav items -->
<b-navbar-nav class="ml-auto">
<b-nav-form>
<b-form-input
size="sm"
class="mr-sm-2"
placeholder="Search for a meal"
v-model="meal"
></b-form-input>
<b-button
size="sm"
class="my-2 my-sm-0"
type="submit"
@click.prevent="getMeal"
>Search</b-button>
</b-nav-form>
<b-nav-item-dropdown right>
<!-- Using 'button-content' slot -->
<template slot="button-content"><em>User</em></template>
<b-dropdown-item href="#">Profile</b-dropdown-item>
<b-dropdown-item href="#">Sign Out</b-dropdown-item>
</b-nav-item-dropdown>
</b-navbar-nav>
</b-collapse>
</b-container>
</b-navbar>
</div>
</template>
<script>
export default {
data() {
return {
meal: ''
}
},
methods: {
getMeal() {
...
}
}
}
</script>
@yangmh66
Copy link

yangmh66 commented May 7, 2019

Just tried the example, but got an error in Line# 47 : Unexpected token '...'

ERROR Failed to compile with 1 errors

error in ./src/components/Navbar.vue?vue&type=script&lang=js&

Syntax Error: SyntaxError: D:\Work\bootstrapvue\bootstrapvue-demo\src\components\Navbar.vue: Unexpected token (47:6)

45 | methods: {
46 | getMeal() {

47 | ...
| ^
48 | }
49 | }
50 | }

@GBS-1
Copy link

GBS-1 commented May 8, 2019

Removing line 47 (the "..." one) will get it compiling so that you can display the page. I assume some code will need to be added there, but have yet to work out what.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment