filter
vue3中无过滤器,建议用方法调用或计算属性替换它们。或者是注册全局属性,使用globalProperties属性。
import {createApp} from 'vue'
import App from './App.vue'
import './index.css'
const app = createApp(App);
app.config.globalProperties.$filters = {
filterCount(value: any) {
return '$' + value;
}
};
app.mount('#app');
// use
<button @click="count++">count is: {{ $filters.filterCount(count) }}</button>
组合式API setup
里面可以放置