我想将我的from kivy.clock import Clock
from kivy.lang import Builder
from kivymd.app import MDApp
from kivy.uix.screenmanager import Screen, ScreenManager
from kivymd.uix.menu import MDDropdownMenu
class MainWindow(Screen):
def __init__(self, **kwargs):
super().__init__(**kwargs)
Clock.schedule_once(self.setup)
def setup(self, *args):
self.menu_items = [ {'text':'abba'}, {'text':'dabba'}, {'text':'doo'}]
self.menu = MDDropdownMenu(
caller=self.drop,
callback=self.drop_down,
width_mult=4,
items=self.menu_items)
@staticmethod
def drop_down(instance):
print(instance.text)
class WindowManager(ScreenManager):
pass
class MyApp(MDApp):
def build(self):
return WindowManager()
if __name__ == '__main__':
MyApp().run()
组件用作链接,因此无论何时单击它,都将导致正确的描述。
JobPost
我有这个。我的问题是如何使其链接?
我尝试用<JobPost
v-for="job in jobs"
:key="job.id"
:details="job.post"
:to="{ name: 'job', params: { id: job.id } }"
/>
包装它,但是这样我又得到了一个nuxt-link
组件
JobPost
答案 0 :(得分:0)
我认为此示例可能适合您的问题:
import {action} from '@storybook/addon-actions'
// import VueRouter from 'vue-router' - not needed
// import NuxtLink from 'nuxt/lib/app/components/nuxt-link' - not needed
Vue.component('RouterLink', {
props: ['to'],
methods: {
log() {
action('link target')(this.to)
},
},
template: '<div @click="log()"><slot>RouterLink</slot></div>',
})
Vue.component('NuxtLink', {
props: ['to'],
methods: {
log() {
action('link target')(this.to)
},
},
template: '<div @click="log()"><slot>NuxtLink</slot></div>',
})
答案 1 :(得分:0)
您可以使用 @click 事件来调用this。$ router.push()方法,也可以使用nuxt-link组件包装作业发布组件的根元素。
let data = {
featured_img: req.file.featured_img,
title: req.file.title,
band_name: req.file.band_name,
audio: req.file.audio
};